Replace custom NAV login authenticator with a series of Django authentication backends #3626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Scope and purpose
Fixes #3625. Dependent on #3624
This explicitly sets
AUTHENTICATION_BACKENDSin Django settings to include the standardModelBackendfrom Django, and the newLdapBackendimplemented in #3624.It changes the existing implementation of NAV's
do_login()view to use Django's authentication mechanism, rather than NAV's customauthenticate()function, making the login flow work with the new authentication backends instead.However, tests are not updated yet. ATM, the failing tests mostly concern themselves with testing the now-removed
nav.web.auth.authenticate()function, so these tests will have to be re-thought (likely, they could be removed and rebuilt as tests for the new ldap backend instead?)Also, these changes to not consider the
REMOTE_USER-based login mechanism, so @hmpf may have to look into that before we can merge this.All in all, the goal is that this should be mergeable before/without completing a transition to implementing django-allauth in NAV.
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.