Skip to content

Commit

Permalink
Disable overloading BaseAuth login method
Browse files Browse the repository at this point in the history
  • Loading branch information
itglob committed Dec 25, 2024
1 parent a4266c9 commit 7df2fb3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions radicale/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"""

from typing import Sequence, Set, Tuple, Union
from typing import Sequence, Set, Tuple, Union, final

from radicale import config, types, utils
from radicale.log import logger
Expand All @@ -50,7 +50,6 @@ def load(configuration: "config.Configuration") -> "BaseAuth":
return utils.load_plugin(INTERNAL_TYPES, "auth", "Auth", BaseAuth,
configuration)


class BaseAuth:

_ldap_groups: Set[str] = set([])
Expand Down Expand Up @@ -102,6 +101,7 @@ def _login(self, login: str, password: str) -> str:

raise NotImplementedError

@final
def login(self, login: str, password: str) -> str:
if self._lc_username:
login = login.lower()
Expand Down
2 changes: 1 addition & 1 deletion radicale/auth/dovecot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, configuration):
self.timeout = 5
self.request_id_gen = itertools.count(1)

def login(self, login, password):
def _login(self, login, password):
"""Validate credentials.
Check if the ``login``/``password`` pair is valid according to Dovecot.
Expand Down
2 changes: 1 addition & 1 deletion radicale/auth/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _login3(self, login: str, password: str) -> str:
pass
return ""

def login(self, login: str, password: str) -> str:
def _login(self, login: str, password: str) -> str:
"""Validate credentials.
In first step we make a connection to the ldap server with the ldap_reader_dn credential.
In next step the DN of the user to authenticate will be searched.
Expand Down
2 changes: 1 addition & 1 deletion radicale/tests/custom/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class Auth(auth.BaseAuth):

def login(self, login: str, password: str) -> str:
def _login(self, login: str, password: str) -> str:
if login == "tmp":
return login
return ""

0 comments on commit 7df2fb3

Please sign in to comment.