Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
346 views
in Technique[技术] by (71.8m points)

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

question from:https://stackoverflow.com/questions/66066638/unable-to-provide-windows-authentication-to-django-ui-using-iis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...