LDAP 身份验证 - 活动目录和 PHP


ldap authentication - active directory and php

>Iv'e看到了许多与通过PHP进行Active Directory身份验证相关的问题。

所有这些都依赖于 ldap_bind()。

我的问题是服务器支持匿名 ldap 绑定,所以我无法对此进行测试。

有没有办法专门检查AD中给定的用户名和密码是否匹配

我看到AD中有一个unicodePwd字段。

非常感谢您的回复

在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...";
    }
}

解决方案 :可以以相同的方式完成(使用 ldap_bind),但请确保用户名和密码值不为空

希望它对其他人有所帮助。