如何获取使用python代码登录客户端的Windows的用户名和域? [英] how to get username and domain of windows logged in client using python code?

查看:57
本文介绍了如何获取使用python代码登录客户端的Windows的用户名和域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户登录到他的桌面Windows时,os将根据Active Directory服务器对他进行身份验证.因此,无论何时他访问网页,都不应抛出登录页面来输入他的用户名或密码.相反,他的用户名和域需要从桌面上捕获并传递到Web服务器.(让他在此后输入密码)

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 his userid or password.Instead, his userid and domain need to be captured from his desktop and passed to the web server.(let him enter password after that)

这是否可能在python中获取客户端的用户名和域?win32api.GetUserName()给出服务器端的用户名.

Is this possible in python to get username and domain of of client? win32api.GetUserName() gives the username of the server side.

预先感谢

推荐答案

您想要做的就是单点登录(SSO),它在实际的Web服务器上比Django更容易实现.

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

因此,您应该检查如何在Apache/Nginx/whateverYouAreUsing上执行SSO,然后Web服务器会将经过身份验证的用户名转发到您的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.

这篇关于如何获取使用python代码登录客户端的Windows的用户名和域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆