Skip to content Skip to sidebar Skip to footer

How To Get Username And Domain Of Windows Logged In Client Using Python Code?

when user logs in to his desktop windows os authenticates him against Active Directory Server. so Whenever he accesses a web page he should not be thrown a login page for entering

Solution 1:

Hmm... what you probably want to do is use Django's RemoteUserMiddleware and leave user authentication to the Web Server which can then be configured to handle it. The solution from Ntlm/Kerberos authentication in Django should work, but as mentioned it's a bit quirky - not all browsers support it correctly, and you have to modify browser settings for it to work.

Solution 2:

What you want to do is called Single sign on (SSO) and it's much easier to implement on actual web server than Django.

So, you should check how to do SSO on Apache/Nginx/whateverYouAreUsing, then the web server will forward the authenticated username to your django app.

Solution 3:

This sounds like a javascript question to me. I think you'll have to add javascript to your login page that attempts to access the details and returns them to the server.

I would have thought that there would be security measures to prevent this, however this question suggests others have managed something similar.

UPDATE

It looks like there might be some useful information in the django docs

Post a Comment for "How To Get Username And Domain Of Windows Logged In Client Using Python Code?"