mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #25187 -- Made request available in authentication backends.
This commit is contained in:
parent
32c0d823e5
commit
4b9330ccc0
12 changed files with 106 additions and 24 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue