diff options
| author | Aleksej Manaev <aleksej.manaev@gmx.de> | 2016-07-11 16:40:39 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-12 20:11:53 -0400 |
| commit | 4b9330ccc04575f9e5126529ec355a450d12e77c (patch) | |
| tree | 90d340a9d28bd448b3b709b8b605bd1009bbba0a /docs/ref | |
| parent | 32c0d823e5316aa7d616a69996919b62748368cc (diff) | |
Fixed #25187 -- Made request available in authentication backends.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/auth.txt | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/docs/ref/contrib/auth.txt b/docs/ref/contrib/auth.txt index f12b16daa0..38f18b6dc8 100644 --- a/docs/ref/contrib/auth.txt +++ b/docs/ref/contrib/auth.txt @@ -518,7 +518,7 @@ The following backends are available in :mod:`django.contrib.auth.backends`: implement them other than returning an empty set of permissions if ``obj is not None``. - .. method:: authenticate(username=None, password=None, **kwargs) + .. method:: authenticate(request, username=None, password=None, **kwargs) Tries to authenticate ``username`` with ``password`` by calling :meth:`User.check_password @@ -528,6 +528,14 @@ The following backends are available in :mod:`django.contrib.auth.backends`: <django.contrib.auth.models.CustomUser.USERNAME_FIELD>`. Returns an authenticated user or ``None``. + ``request`` is an :class:`~django.http.HttpRequest` and may be ``None`` + if it wasn't provided to :func:`~django.contrib.auth.authenticate` + (which passes it on to the backend). + + .. versionchanged:: 1.11 + + The ``request`` argument was added. + .. method:: get_user_permissions(user_obj, obj=None) Returns the set of permission strings the ``user_obj`` has from their @@ -603,7 +611,7 @@ The following backends are available in :mod:`django.contrib.auth.backends`: :class:`~django.contrib.auth.models.User` object is created if not already in the database. Defaults to ``True``. -.. method:: RemoteUserBackend.authenticate(remote_user) +.. method:: RemoteUserBackend.authenticate(request, 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 @@ -614,6 +622,10 @@ The following backends are available in :mod:`django.contrib.auth.backends`: ``False`` and a ``User`` object with the given username is not found in the database. + ``request`` is an :class:`~django.http.HttpRequest` and may be ``None`` if + it wasn't provided to :func:`~django.contrib.auth.authenticate` (which + passes it on to the backend). + .. method:: RemoteUserBackend.clean_username(username) Performs any cleaning on the ``username`` (e.g. stripping LDAP DN |
