Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
django.contrib.auth: Relax ModelBackend -> BaseBackend (#2141)
`BaseBackend` is the base interface of django backends, `ModelBackend` has more specific signatures, such as `.authenticate()` including `username` and `password`, not all authentication backends use those. For instance, since the `authenticate()` method in BaseBackend already includes request (`HttpRequest`), it can read a `Bearer` token or cookie, and already accepts `**kwargs` for additional parameters. See also: - BaseBackend: https://github.com/django/django/blob/5.0.6/django/contrib/auth/backends.py#L8-L28 - ModelBackend: https://github.com/django/django/blob/5.0.6/django/contrib/auth/backends.py#L31-L160 - django.contrib.auth.authenticate(): https://github.com/django/django/blob/5.0.6/django/contrib/auth/__init__.py#L65-L93 - Django Docs for "Writing an authentication backend": https://docs.djangoproject.com/en/5.0/topics/auth/customizing/#writing-an-authentication-backend
- Loading branch information