python - Django authenticate using logged in windows domain user -


i want authenticate django web user using windows domain account (active directory) logged in computer. how can without prompting user enter username/password again since logged in using domain account system. using django , python 2.7. went through following link dint understand how use in views. please me.

thanks

when web server(here django hosted on iis) takes care of authentication typically sets remote_user environment variable use in underlying application. in django, remote_user made available in request.meta attribute. django can configured make use of theremote_user value using remoteusermiddleware , remoteuserbackend classes found in django.contrib.auth. configurations must add django.contrib.auth.middleware.remoteusermiddleware middleware_classes setting after django.contrib.auth.middleware.authenticationmiddleware:

middleware_classes = (     ...     'django.contrib.auth.middleware.authenticationmiddleware',     'django.contrib.auth.middleware.remoteusermiddleware',     ...     ) next, must replace modelbackend remoteuserbackend in authentication_backends setting:  authentication_backends = (     'django.contrib.auth.backends.remoteuserbackend', ) 

with setup, remoteusermiddleware detect username in request.meta['remote_user'] , authenticate , auto-login user using remoteuserbackend.

(more info https://docs.djangoproject.com/en/1.5/howto/auth-remote-user/ )

to remote_user in request following iis settings:

1.in control panel, click programs , features, , click turn windows features on or off.

2.expand internet information services, expand world wide web services, expand security, , select windows authentication.

iis manager

  1. open iis manager , navigate level want manage.
  2. in features view, double-click authentication.
  3. on authentication page, select windows authentication.
  4. in actions pane, click enable use windows authentication. (more info http://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication )

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -