NTLM Authentication

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stealth86
Forum Newbie
Posts: 2
Joined: Mon Mar 03, 2008 11:52 am

NTLM Authentication

Post by stealth86 »

Hi,

I'm using the mod_auth_sspi for apache 2.2 (in windows), to do NTLM authentication. I have it setup, and it works fine. Trying to access a protected page properly authenticates the user.

What I haven't been able to figure out, is what do I need to do to get the username of the person who just authenticated?

I've enabled authentication by adding these lines to my apache http.conf file.

Code: Select all

LoadModule sspi_auth_module modules/mod_auth_sspi.so
 
<Location /--Removed-->
        AuthName "--Removed--"
        AuthType SSPI
        SSPIAuth On
        SSPIAuthoritative On
        SSPIOfferBasic On
        # SSPIBasicPreferred
        # SSPIUsernameCase lower
        require valid-user
</Location>
I've also noticed that this module doesn't seem to be in active development anymore. Are there better modules for apache on windows to do NTLM Authentication?

Thanks!
stealth86
Forum Newbie
Posts: 2
Joined: Mon Mar 03, 2008 11:52 am

Re: NTLM Authentication

Post by stealth86 »

Well, it seems I answered my own question :oops: .

Code: Select all

$cred = explode('\\',$_SERVER['REMOTE_USER']);
if (count($cred) == 1) array_unshift($cred, "(no domain info - perhaps SSPIOmitDomain is On)");
list($domain, $user) = $cred;
 
echo "You appear to be user <B>$user</B><BR/>";
echo "logged into the Windows NT domain <B>$domain</B>";
I am still curious about my second question however.
I've also noticed that this module doesn't seem to be in active development anymore. Are there better modules for apache on windows to do NTLM Authentication?

Thanks!
phantom82
Forum Newbie
Posts: 2
Joined: Wed Feb 08, 2012 1:59 am

Re: NTLM Authentication

Post by phantom82 »

Hello Stealth68,

Been years you posted and I am stuck with it now.

I am trying to have the single sign on for an Intranet site. The site is setup on Apache 2.2 on Windows 2008 server. The users need to be authenticated against AD thats Windows 2008 Server. Now I have implemented the SSPI module for Apache but no use. I can't even see the REMOTE_USER server variable when queried through phpinfo(); function. Echoing the variable gives you blank results so it's not capturing the username.
Post Reply