When a web server (here django hosted in IIS) performs authentication, it usually sets the REMOTE_USER environment REMOTE_USER for use in the base application. In Django, REMOTE_USER is available in the request.META attribute. Django can be configured to use the REMOTE_USER value using the RemoteUserMiddleware and RemoteUserBackend classes found in django.contrib.auth. Configurations You must add the django.contrib.auth.middleware.RemoteUserMiddleware parameter to MIDDLEWARE_CLASSES after django.contrib.auth.middleware.AuthenticationMiddleware :
MIDDLEWARE_CLASSES = ( ... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.RemoteUserMiddleware', ... )
Then you should replace ModelBackend with RemoteUserBackend in the AUTHENTICATION_BACKENDS setting:
AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.RemoteUserBackend', )
With this setting, RemoteUserMiddleware will determine the username in request.META['REMOTE_USER'] and will authenticate and automatically log in using RemoteUserBackend .
(Additional information https://docs.djangoproject.com/en/1.5/howto/auth-remote-user/ )
To get REMOTE_USER in the request, complete the following IIS settings:
1. In the control panel, select "Programs and Features," and then click "Turn Windows Features On or Off."
2. Open Internet Information Services, expand the World Wide Web, expand the Security node, and select Windows Authentication.
IIS Manager
- Open IIS Manager and go to the level you want to manage.
- In the Features view, double-click Authentication.
- On the Authentication page, select Windows Authentication.
- In the Actions panel, click Enable to use Windows Authentication. ( Additional Information )
source share