Middleware
UserSyncMiddleware
Sync users against LDAP when is needed.
WAUTH_RESYNC_DELTA
setting.WAUTH_USE_CACHE
setting.This middleware must be positioned after the AuthenticationMiddleware
and RemoteUserMiddleware
middleware.
MIDDLEWARE = [
# ...
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'windows_auth.middleware.UserSyncMiddleware',
# ...
]
SimulateWindowsAuthMiddleware
Simulate a remote user authenticated through Windows Authentication. This is useful for developing and testing without actually deploying the Django project to IIS.
When no actual windows authentication information passed from the IIS, this middleware will inject the request
with the REMOTE_USER
header, just like if WAUTH_SIMULATE_USER
had logged in via Windows Authentication.
This middleware is bypassed when DEBUG
setting is not True
.
Warning
You must configure the setting WAUTH_SIMULATE_USER
to specify the user to impersonate.
MIDDLEWARE = [
'windows_auth.middleware.SimulateWindowsAuthMiddleware',
# ...
]
WAUTH_SIMULATE_USER = "EXAMPLE\\Administrator"
It should be positioned as high as possible in the middleware setting to allow for