I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?
Active Directory (AD) is a service run by CITES to manage usernames and passwords. Your AD username is the same as your netID. If you are a Windows user, it is the same username and password that you currently use to log into your desktop.
Active Directory (AD) is more than just a repository of IDs and passwords; it's the center of just about every bit of security in your network. Going beyond the rudimentary managing of permissions, AD establishes policies and controls over what privileges accounts have, and how those account can be used.
Check the AUTH_USER
request variable. This will be empty if your web app allows anonymous access, but if your server's using basic or Windows integrated authentication, it will contain the username of the authenticated user.
In an Active Directory domain, if your clients are running Internet Explorer and your web server/filesystem permissions are configured properly, IE will silently submit their domain credentials to your server and AUTH_USER
will be MYDOMAIN\user.name
without the users having to explicitly log in to your web app.
I've got php mysql running on IIS - I can use $_SERVER["AUTH_USER"]
if I turn on Windows Authentication in IIS -> Authentication and turn off Anonymous authentication (important)
I've used this to get my user and domain:
$user = $_SERVER['AUTH_USER'];
$user
will return a value like: DOMAIN\username
on our network, and then it's just a case of removing the DOMAIN\
from the string.
This has worked in IE, FF, Chrome, Safari (tested) so far.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With