简体   繁体   中英

NTLM Login using PHP and Apache

I would like to login into my system using ntlm protocol. I found module for apache - mod_auth_sspi, but i need multi platform solution.

My application have to run on windows and linux (on both is installed php>=5.3 and apache>2.0). Using mod_auth_sspi i am able to login via ntlm, but only if I set a:

required user-valid

in htaccess or http.conf. If I don't set this value I can't retrieve USER_REMOTE and I don't know how can I implement solution that I need:

I'm looking for solution that allow me show to user form with login/password (ntlm) or if user cancelled this form the system should redirect him to alternative login form (data will retrieve from database). I need to login into the system in 2 ways: via NTLM and traditional (database). How Can I do this?

Thx.

You could use mod_auth_sspi for windows, and http://modntlm.sourceforge.net/ for linux. I know it isn't the best solution, but it should work (i guess you will have to check what OS the script is running on and choose the mod appropriately since I doubt the APIs are the same).

EDIT:

For multiple login providers, see this:

http://httpd.apache.org/docs/2.3/howto/auth.html#multprovider

I know old question but might be useful for future users landing here from Google. A cross-platform (I have it running on Windows and Ubuntu) solution would be PyAuthenNTLM2:

https://github.com/Legrandin/PyAuthenNTLM2

An important additional advantage of this module compared to others is that it supports NTLM version 2 (NTLMv2) protocol which is a bit more "secure". It is important that Windows 7 (and AFAIK Vista too) use NTLMv2 only per default (it can be switched in registry) and hence you won't force the windows admins in your company to change this setting.

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