multiple but different defined d.AUTHENTICATION_BACKENDS in settings/defaults.py
ifrh opened this issue · 2 comments
In Praktomat/src/settings/defauls.py there a two places where d.AUTHENTICATION_BACKENDS is defined in different ways:
Praktomat/src/settings/defaults.py
Lines 126 to 128 in aafbeb1
Praktomat/src/settings/defaults.py
Lines 374 to 377 in aafbeb1
This could be a problem, if these settings are not overwritten via local.py, because
-
The order of AUTHENTICATION_BACKENDS matters, so if the same username and password is valid in multiple backends, Django will stop processing at the first positive match.
-
You can use AllowAllUsersModelBackend or AllowAllUsersRemoteUserBackend if you want to allow inactive users to authenticate.
Changed in Django 1.10: In older versions, the ModelBackend allowed inactive users to authenticate.
Above bulletpoints are taken from Django-Docs:
@hannesbraun @ratefuchs I think accounts.ldap_auth.LDAPBackend
should be the first and django.contrib.auth.backends.AllowAllUsersModelBackend
should be the second entry in d.AUTHENTICATION_BACKENDS
.
And there is no need to mention django.contrib.auth.backends.ModelBackend
inside settings/defaults.py.
I agree with that. The ModelBackend
should be replaced with the AllowAllUsersModelBackend
. For the sake of simplicity, it's probably also a good idea to merge those two parts into one where the AUTHENTICATION_BACKENDS
are set.