Restructure crawling and auth related modules

This commit is contained in:
Joscha
2021-05-23 19:16:42 +02:00
parent bbf9f8f130
commit 2fdf24495b
13 changed files with 29 additions and 33 deletions

20
PFERD/auth/__init__.py Normal file
View File

@ -0,0 +1,20 @@
from configparser import SectionProxy
from typing import Callable, Dict
from ..config import Config
from .authenticator import Authenticator, AuthSection
from .simple import SimpleAuthenticator, SimpleAuthSection
from .tfa import TfaAuthenticator
AuthConstructor = Callable[[
str, # Name (without the "auth:" prefix)
SectionProxy, # Authenticator's section of global config
Config, # Global config
], Authenticator]
AUTHENTICATORS: Dict[str, AuthConstructor] = {
"simple": lambda n, s, c:
SimpleAuthenticator(n, SimpleAuthSection(s), c),
"tfa": lambda n, s, c:
TfaAuthenticator(n, AuthSection(s), c),
}