Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30226 closed New feature (fixed)

Add base authentication backend to ease custom backend creation.

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 (10)

comment:1 by Carlton Gibson, 5 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, 5 years ago

Needs tests: unset

comment:3 by Carlton Gibson, 5 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, 5 years ago

Patch needs improvement: unset

comment:5 by Tobias Bengfort, 5 years ago

Description: modified (diff)

comment:6 by Carlton Gibson, 5 years ago

Triage Stage: AcceptedReady for checkin

comment:7 by Tim Graham, 5 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:8 by Tobias Bengfort, 5 years ago

Patch needs improvement: unset

comment:9 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: newclosed

In 75337a6:

Fixed #30226 -- Added BaseBackend for authentication.

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 581a0f45:

Refs #30226 -- Added User.get_user_permissions() method.

Added to mirror the existing User.get_group_permissions().

Note: See TracTickets for help on using tickets.
Back to Top