mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Clean up authenticator code formatting
This commit is contained in:
parent
1ce32d2f18
commit
49ad1b6e46
@ -17,10 +17,10 @@ AuthConstructor = Callable[[
|
|||||||
AUTHENTICATORS: Dict[str, AuthConstructor] = {
|
AUTHENTICATORS: Dict[str, AuthConstructor] = {
|
||||||
"credential-file": lambda n, s, c:
|
"credential-file": lambda n, s, c:
|
||||||
CredentialFileAuthenticator(n, CredentialFileAuthSection(s)),
|
CredentialFileAuthenticator(n, CredentialFileAuthSection(s)),
|
||||||
|
"keyring": lambda n, s, c:
|
||||||
|
KeyringAuthenticator(n, KeyringAuthSection(s)),
|
||||||
"simple": lambda n, s, c:
|
"simple": lambda n, s, c:
|
||||||
SimpleAuthenticator(n, SimpleAuthSection(s)),
|
SimpleAuthenticator(n, SimpleAuthSection(s)),
|
||||||
"tfa": lambda n, s, c:
|
"tfa": lambda n, s, c:
|
||||||
TfaAuthenticator(n),
|
TfaAuthenticator(n),
|
||||||
"keyring": lambda n, s, c:
|
|
||||||
KeyringAuthenticator(n, KeyringAuthSection(s)),
|
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,7 @@ class AuthSection(Section):
|
|||||||
|
|
||||||
|
|
||||||
class Authenticator(ABC):
|
class Authenticator(ABC):
|
||||||
def __init__(
|
def __init__(self, name: str) -> None:
|
||||||
self,
|
|
||||||
name: str
|
|
||||||
) -> None:
|
|
||||||
"""
|
"""
|
||||||
Initialize an authenticator from its name and its section in the config
|
Initialize an authenticator from its name and its section in the config
|
||||||
file.
|
file.
|
||||||
|
@ -18,11 +18,7 @@ class KeyringAuthSection(AuthSection):
|
|||||||
|
|
||||||
class KeyringAuthenticator(Authenticator):
|
class KeyringAuthenticator(Authenticator):
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, name: str, section: KeyringAuthSection) -> None:
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
section: KeyringAuthSection,
|
|
||||||
) -> None:
|
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
|
|
||||||
self._username = section.username()
|
self._username = section.username()
|
||||||
|
@ -14,11 +14,7 @@ class SimpleAuthSection(AuthSection):
|
|||||||
|
|
||||||
|
|
||||||
class SimpleAuthenticator(Authenticator):
|
class SimpleAuthenticator(Authenticator):
|
||||||
def __init__(
|
def __init__(self, name: str, section: SimpleAuthSection) -> None:
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
section: SimpleAuthSection,
|
|
||||||
) -> None:
|
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
|
|
||||||
self._username = section.username()
|
self._username = section.username()
|
||||||
|
@ -6,10 +6,7 @@ from .authenticator import Authenticator, AuthError
|
|||||||
|
|
||||||
|
|
||||||
class TfaAuthenticator(Authenticator):
|
class TfaAuthenticator(Authenticator):
|
||||||
def __init__(
|
def __init__(self, name: str) -> None:
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
) -> None:
|
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
|
|
||||||
async def username(self) -> str:
|
async def username(self) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user