1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-07-26 17:58:30 +00:00

added compatibility with a case-insensitive authentication provider

This commit is contained in:
IM 2024-04-17 18:31:51 +03:00
parent 76dc9dce0d
commit 239e17d735
5 changed files with 17 additions and 4 deletions

View file

@ -44,6 +44,8 @@ def load(configuration: "config.Configuration") -> "BaseAuth":
class BaseAuth:
_lc_username: bool
def __init__(self, configuration: "config.Configuration") -> None:
"""Initialize BaseAuth.
@ -53,6 +55,7 @@ class BaseAuth:
"""
self.configuration = configuration
self._lc_username = configuration.get("auth", "lc_username")
def get_external_login(self, environ: types.WSGIEnviron) -> Union[
Tuple[()], Tuple[str, str]]:
@ -67,7 +70,7 @@ class BaseAuth:
"""
return ()
def login(self, login: str, password: str) -> str:
def _login(self, login: str, password: str) -> str:
"""Check credentials and map login to internal user
``login`` the login name
@ -79,3 +82,6 @@ class BaseAuth:
"""
raise NotImplementedError
def login(self, login: str, password: str) -> str:
return self._login(login, password).lower() if self._lc_username else self._login(login, password)