简体   繁体   中英

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.

What I want to know is, how do I go about grabbing their username?

I thought this would do the trick: $_SERVER['auth_user']; but no luck.

Just like this Can you get a Windows (AD) username in PHP?

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:

<script type="text/javascript">
<!--
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName);
//-->
</script> 

Just add some AJAX ;)

HTH

If your PHP is running on IIS, then you can lock it down at that level. 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.

You can do it in Apache with mod_auth http://rc.quest.com/topics/mod_auth_vas/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM