[英]Grab username from IE, to authenticate against LDAP
The users will only use IE, and within IE it can pass their credentials without being prompted to, if they are logged onto the domain controller. 用户将仅使用IE,并且在IE中,如果他们登录到域控制器,则可以在不提示的情况下传递其凭据。
What I want to know is, how do I go about grabbing their username? 我想知道的是,如何获取他们的用户名?
I thought this would do the trick: $_SERVER['auth_user'];
我以为这可以解决问题:
$_SERVER['auth_user'];
but no luck. 但没有运气。
Just like this Can you get a Windows (AD) username in PHP? 就像这样您可以在PHP中获得Windows(AD)用户名吗?
But I don't know what the code should look like this to capture/grab the user's username 但我不知道该如何捕获/获取用户名
Any help is appreciated. 任何帮助表示赞赏。
There is no way to solve the problem in php directly, but you can obtain the username with the help of javascript: 没有办法直接解决php中的问题,但是您可以借助javascript获取用户名:
<script type="text/javascript">
<!--
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName);
//-->
</script>
Just add some AJAX ;) 只需添加一些AJAX;)
HTH HTH
If your PHP is running on IIS, then you can lock it down at that level. 如果您的PHP在IIS上运行,则可以将其锁定在该级别。 I'm not sure you can get access to the username, but at least it'd only be available to authenticated users with proper permissions to access the site.
我不确定您是否可以访问用户名,但至少只有具有适当权限的经过身份验证的用户才能访问该用户名。 Hope this was a little helpful.
希望这会有所帮助。
You have to enable Integrated Authentication on the application folder in IIS, then your method will work. 您必须在IIS中的应用程序文件夹上启用“集成身份验证”,然后您的方法才能起作用。
You can do it in Apache with mod_auth http://rc.quest.com/topics/mod_auth_vas/ 您可以在Apache中使用mod_auth http://rc.quest.com/topics/mod_auth_vas/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.