summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-04-18 16:06:26 -0400
committerTim Graham <timograham@gmail.com>2014-04-18 16:06:26 -0400
commit26d118c3fea34d9487a93b8ae570ef90e7079a76 (patch)
tree9818401039691b14e97da8870da028b60fa73375 /docs/ref
parent11ac50b18e578498c1d95e0a75921b5864387d46 (diff)
Moved RemoteUserBackend documentation to reference guide.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/auth.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/ref/contrib/auth.txt b/docs/ref/contrib/auth.txt
index 534edb1f09..f80193c4cc 100644
--- a/docs/ref/contrib/auth.txt
+++ b/docs/ref/contrib/auth.txt
@@ -433,3 +433,37 @@ The following backends are available in :mod:`django.contrib.auth.backends`:
:attr:`request.META['REMOTE_USER'] <django.http.HttpRequest.META>`. See
the :doc:`Authenticating against REMOTE_USER </howto/auth-remote-user>`
documentation.
+
+ If you need more control, you can create your own authentication backend
+ that inherits from this class and override these attributes or methods:
+
+.. attribute:: RemoteUserBackend.create_unknown_user
+
+ ``True`` or ``False``. Determines whether or not a
+ :class:`~django.contrib.auth.models.User` object is created if not already
+ in the database. Defaults to ``True``.
+
+.. method:: RemoteUserBackend.authenticate(remote_user)
+
+ The username passed as ``remote_user`` is considered trusted. This method
+ simply returns the ``User`` object with the given username, creating a new
+ ``User`` object if :attr:`~RemoteUserBackend.create_unknown_user` is
+ ``True``.
+
+ Returns ``None`` if :attr:`~RemoteUserBackend.create_unknown_user` is
+ ``False`` and a ``User`` object with the given username is not found in the
+ database.
+
+.. method:: RemoteUserBackend.clean_username(username)
+
+ Performs any cleaning on the ``username`` (e.g. stripping LDAP DN
+ information) prior to using it to get or create a
+ :class:`~django.contrib.auth.models.User` object. Returns the cleaned
+ username.
+
+.. method:: RemoteUserBackend.configure_user(user)
+
+ Configures a newly created user. This method is called immediately after a
+ new user is created, and can be used to perform custom setup actions, such
+ as setting the user's groups based on attributes in an LDAP directory.
+ Returns the user object.