Add documentation to BaseAuth

This commit is contained in:
Unrud 2017-09-17 14:03:51 +02:00
parent d9aafd154e
commit 106aeae781

View File

@ -93,19 +93,35 @@ class BaseAuth:
def get_external_login(self, environ): def get_external_login(self, environ):
"""Optionally provide the login and password externally. """Optionally provide the login and password externally.
Returns a tuple (login, password) or (). ``environ`` a dict with the WSGI environment
If ``()`` is returned, Radicale handles HTTP authentication.
Otherwise, returns a tuple ``(login, password)``. For anonymous users
``login`` must be ``""``.
""" """
return () return ()
def is_authenticated(self, user, password): def is_authenticated(self, user, password):
"""Validate credentials.""" """Validate credentials.
``user`` the user from ``map_login_to_user(login)``.
``password`` the login password
""" """
raise NotImplementedError raise NotImplementedError
def map_login_to_user(self, login): def map_login_to_user(self, login):
"""Map login to internal username.""" """Map login name to internal user.
``login`` the login name, ``""`` for anonymous users
Returns a string with the user name.
If a login can't be mapped to an user, return ``login`` and
return ``False`` in ``is_authenticated(...)``.
"""
return login return login