From 106aeae781305d1fcac02ca5a4c8f14ec778d849 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 17 Sep 2017 14:03:51 +0200 Subject: [PATCH] Add documentation to BaseAuth --- radicale/auth.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/radicale/auth.py b/radicale/auth.py index 32f6d1d..64219d7 100644 --- a/radicale/auth.py +++ b/radicale/auth.py @@ -93,19 +93,35 @@ class BaseAuth: def get_external_login(self, environ): """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 () 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 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