Opened 6 years ago

Last modified 5 years ago

#30226 closed New feature

Add base authentication backend to ease custom backend creation. — at Version 5

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 (last modified by Tobias Bengfort)

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 confusing for backend authors.

Mailinglist thread: https://groups.google.com/forum/#!topic/django-developers/CNmz22gEsCc
Pull request: https://github.com/django/django/pull/11037

Change History (5)

comment:1 by Carlton Gibson, 6 years ago

Needs tests: set
Summary: Simplify authentication backend interfaceAdd base authentication backend to ease custom backend creation.
Triage Stage: UnreviewedAccepted
Type: Cleanup/optimizationNew feature
Version: 2.1master

comment:2 by Tobias Bengfort, 6 years ago

Needs tests: unset

comment:3 by Carlton Gibson, 6 years ago

Patch needs improvement: set

I left a few comments on the PR. When they're addressed, good to go.

comment:4 by Tobias Bengfort, 6 years ago

Patch needs improvement: unset

comment:5 by Tobias Bengfort, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top