简体   繁体   English

从IE抓取用户名,以针对LDAP进行身份验证

[英]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.

相关问题 PHP LDAP连接可从外部服务器对Active Directory进行身份验证 - PHP LDAP Connection to Authenticate against Active Directory from External Server Symfony:针对LDAP服务器对用户进行身份验证,但仅当用户名在自定义db表中时才允许登录 - Symfony: Authenticate users against LDAP server, but allow login only if their username is in custom db table 在使用IE / Firefox时使用PHP,活动目录对ldap进行身份验证 - Authenticate against ldap using PHP, active directory, while using IE/Firefox LDAP:无法使用用户名中的句点对用户进行身份验证 - LDAP: Cannot authenticate users with period in username 从数据库中获取用户名 - Grab username from database 使用php ldap对活动目录进行身份验证时收到错误 - getting error when authenticate against active directory with php ldap 如何从PHP登录项目中获取用户名 - How to grab username from the PHP Login Project 如何从LDAP获取用户名? - How can I get a username from LDAP? 使用本地Windows用户名和密码进行身份验证的Intranet Web应用程序,使用PHP和LDAP进行身份验证 - Intranet web applications that use the local windows username and password to authenticate using PHP & LDAP CakePHP使用LDAP进行身份验证 - CakePHP Authenticate with LDAP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM