Opened 7 years ago
Last modified 6 years ago
#30226 closed New feature
Simplify authentication backend interface — at Initial Version
| Reported by: | Tobias Bengfort | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.auth | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Currently, writing a new authentication backend requires quite some boilerplate e.g. has_perm() can be derived from get_all_permissions() which in turn can be derived from get_user_permissions() and get_group_permissions(). Additionally, authenticate() and get_user() should always return None for backends that only handle permissions.
Also note that get_all_permissions() and get_group_permissions() exist on the User model, but get_user_permissions() does not. I think this is confisuing for backend authors.
Mailinglist thread: https://groups.google.com/forum/#!topic/django-developers/CNmz22gEsCc
Pull request: https://github.com/django/django/pull/11037