django-keycloak icon indicating copy to clipboard operation
django-keycloak copied to clipboard

Django admin not working when AUTHENTICATION_BACKENDS not set properly

Open kristall opened this issue 4 years ago • 2 comments

Under https://django-keycloak.readthedocs.io/en/latest/index.html#setup is the point

AUTHENTICATION_BACKENDS = [
   ...
   'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]

but in an "vanilla" settings file is no AUTHENTICATION_BACKENDS so the ... need to be replace with the default value (see https://docs.djangoproject.com/en/3.1/ref/settings/#auth): 'django.contrib.auth.backends.ModelBackend',, so that it looks like this

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]

else the django superuser can not login to the django admin. I banged my head for 2 hours against that, so I leave a clue here for others ...

kristall avatar Sep 25 '20 04:09 kristall

Under https://django-keycloak.readthedocs.io/en/latest/index.html#setup is the point

AUTHENTICATION_BACKENDS = [
   ...
   'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]

but in an "vanilla" settings file is no AUTHENTICATION_BACKENDS so the ... need to be replace with the default value (see https://docs.djangoproject.com/en/3.1/ref/settings/#auth): 'django.contrib.auth.backends.ModelBackend',, so that it looks like this

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]

else the django superuser can not login to the django admin. I banged my head for 2 hours against that, so I leave a clue here for others ...

Thank you very much.

cjy543731778 avatar Nov 06 '20 03:11 cjy543731778

Under https://django-keycloak.readthedocs.io/en/latest/index.html#setup is the point

AUTHENTICATION_BACKENDS = [
   ...
   'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]

but in an "vanilla" settings file is no AUTHENTICATION_BACKENDS so the ... need to be replace with the default value (see https://docs.djangoproject.com/en/3.1/ref/settings/#auth): 'django.contrib.auth.backends.ModelBackend',, so that it looks like this

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]

else the django superuser can not login to the django admin. I banged my head for 2 hours against that, so I leave a clue here for others ...

Thanks, this was helpful

bowerta avatar Nov 23 '20 19:11 bowerta