Niranjana Neeranj
Niranjana Neeranj

Reputation: 93

Unable to provide windows authentication to Django UI using IIS

i have a django web app installed and hosted on IIS on server . Currently it is not provided with any authentication , but i want to give it windows authentication so that if anyone tries to access the url should provide windows username and password .

made a small research on this topic and as am new towards this authentication using windows i want someone's help .

So the first step i did was to modify settings.py file of Django project . As seen on question https://stackoverflow.com/questions/26881344/django-authenticate-using-logged-in-windows-domain-user

i added

MIDDLEWARE_CLASSES = (
    ...
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.RemoteUserMiddleware',
    ...
)

and

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.RemoteUserBackend',
)

to settings.py . and next i migrated the app and ran server . restarted the app .

and as per the answer for the above stack qustion it required changing or enabling of windows authentication on IIS . did as per the instruction from the answer provided in the above stack question

but the issue is no error am getting and no login using windows . it runs as usual without any authentication

Is there any other way to do this . Can anyone help me on this stuff

Upvotes: 0

Views: 634

Answers (1)

Ding Peng
Ding Peng

Reputation: 3954

Django project deployed to IIS we can use the windows authentication in IIS.

First make sure that IIS has installed windows authentication:

enter image description here

Choose Authentication in Django site:

enter image description here

Disable all other authentications and enable windows authentication:

enter image description here

When we access the Django site, we need to enter the windows credentials:

enter image description here

Feel free to let me know if there are any questions.

Upvotes: 1

Related Questions