Can a PHP intranet share Windows logins?

前端 未结 3 1490
一生所求
一生所求 2020-12-28 11:28

I have created some PHP-based intranet resources that require users to log in. The users create their own logins, and I verify that they are logged in using a cookie.

<
相关标签:
3条回答
  • 2020-12-28 12:16

    Often times this is done using a combination of LDAP and NTLM. Browsers like IE and Firefox can do NTLM authentication, which I believe is how Sharepoint works. I run a Java-based portal application that uses LDAP for syncing users and NTLM for authentication.

    What you absolutely do not want to do is have the user enter their domain username and password into the browser. In years past I've seen several projects using this approach with LDAP to authenticate Windows users. You're correct, it is a security concern. The user should enter his or her password only once: when logging in to the workstation. The last thing you want are passwords sitting around in cache / temp files.

    I apologize that I can not provide a "here's how you do it with a PHP app" answer. As far as I know, there is no one answer to this problem.

    (One thing I have done in the past, and I never really checked to see if it was valid or poor form, was to use PHP from IIS. If you're using IIS, then PHP will populate the server variable REMOTE_USER with the Windows user's username (DOMAIN\user). It worked for what I was doing at the time.)

    0 讨论(0)
  • PHP has LDAP support, so you can access Windows' Active Directory

    There is this project on SourceForge: adLDAP - "LDAP Authentication with PHP for Active Directory"

    0 讨论(0)
  • 2020-12-28 12:34

    What you are looking for is NTLM authentication against the PHP website, which is perfectly doable but seems there is no single way in PHP to do it.

    Have a look at http://siphon9.net/loune/2007/10/simple-lightweight-ntlm-in-php/

    You also need to add the sites to your trusted sites in IE (or the equivalent in whichever browser you are using) and in the settings for trusted sites, turn on 'send current username and password'.

    Its not a horrible security hole because the credentials are not sent en clair over the wire, and the end user has specifically told the browser to send credentials to the website in question.

    0 讨论(0)
提交回复
热议问题