1

I have a Django site with IIS 8 and I have followed the Django Docs and this Stackoverflow ticket Django authenticate using logged in windows domain user and added RemoteBackendUser and ModelBackend. Plus I enabled Windows Authentication as well as Anonymous Authentication in my IIS site.

I can login with Windows Authentication but I cannot login to Django Admin (http://mysite/Admin)

The Admin login comes up and says myDomain\username is not authorized to see this page and my Django Superuser credentials simply do not work. Has anyone come across this and figured out a way around it?

1 Answers1

0

Check out this module https://pypi.org/project/django-windowsauth/

You can easily integrate IIS with Windows Authentication to your Django project, including Active Directory synchronization.

With this, you can use the STAFF_GROUPS LDAP setting to specify the Django Admin permissions based on an Active Directory group, so you can never get locked out.

This is how to configure the STAFF_GROUPS setting https://django-windowsauth.readthedocs.io/en/latest/reference/ldap_settings.html#staff-groups

This is what the staff setting does https://docs.djangoproject.com/en/3.1/ref/contrib/auth/#django.contrib.auth.models.User.is_staff

Dan Yishai
  • 726
  • 3
  • 12