From 486699cef3038e3cb00371383af22162e28631c4 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Tue, 25 May 2021 15:11:52 +0200 Subject: [PATCH] Create anonymous TFA authenticator in ilias crawler This ensures that *some* TFA authenticator is always present when authenticating, even if none is specified in the config. The TfaAuthenticator does not depend on any configured values, so it can be created on-demand. --- PFERD/crawl/ilias/kit_ilias_web_crawler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PFERD/crawl/ilias/kit_ilias_web_crawler.py b/PFERD/crawl/ilias/kit_ilias_web_crawler.py index 40db52c..6013d77 100644 --- a/PFERD/crawl/ilias/kit_ilias_web_crawler.py +++ b/PFERD/crawl/ilias/kit_ilias_web_crawler.py @@ -7,7 +7,7 @@ import aiohttp from aiohttp import hdrs from bs4 import BeautifulSoup, Tag -from ...auth import Authenticator +from ...auth import Authenticator, TfaAuthenticator from ...config import Config from ...logging import ProgressBar, log from ...output_dir import FileSink, Redownload @@ -523,7 +523,7 @@ class KitShibbolethLogin: soup: BeautifulSoup ) -> BeautifulSoup: if not self._tfa_auth: - raise RuntimeError("No 'tfa_auth' present but you use two-factor authentication!") + self._tfa_auth = TfaAuthenticator("ilias-anon-tfa") tfa_token = await self._tfa_auth.password()