简体   繁体   English

ldap身份验证-活动目录和php

[英]ldap authentication - active directory and php

Iv'e seen many question related to Active Directory authentication through PHP. 我已经看到许多与通过PHP进行Active Directory身份验证有关的问题。

And all of them rely on on ldap_bind(). 它们都依赖ldap_bind()。

My problem is that the server supports anonym ldap binding, so I can't do my test regarding this. 我的问题是服务器支持匿名ldap绑定,因此我无法对此进行测试。

Is there a way to specifcally check if both given username and password match values in AD ? 有没有办法专门检查给定的用户名和密码是否都与AD中的值匹配

I've seen there is a unicodePwd field in AD. 我已经看到AD中有一个unicodePwd字段。

Many thanks for your replies 非常感谢您的回复

in PHP you can try this: 在PHP中,您可以尝试以下操作:

// connect to ldap server
$ldapconn = ldap_connect("ldap.example.com")
    or die("Could not connect to LDAP server.");

if ($ldapconn) {

    // binding anonymously
    $ldapbind = ldap_bind($ldapconn);

    if ($ldapbind) {
        echo "LDAP bind anonymous successful...";
    } else {
        echo "LDAP bind anonymous failed...";
    }

}

The solution : that can be done the same way (using ldap_bind) but being sure that username and password values are not empty 解决方案:可以用相同的方法(使用ldap_bind)完成,但要确保用户名和密码值不为空

Hope it helps someone else. 希望它可以帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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