【问题标题】:ldap authentication - active directory and phpldap 身份验证 - 活动目录和 php
【发布时间】:2013-10-31 14:05:38
【问题描述】:

我见过很多与通过 PHP 进行 Active Directory 身份验证相关的问题。

而且它们都依赖于 ldap_bind()。

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

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

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

非常感谢您的回复

【问题讨论】:

    标签: php active-directory openldap


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      希望对其他人有所帮助。

      【讨论】:

        猜你喜欢
        • 2018-09-15
        • 2014-12-25
        • 1970-01-01
        • 2018-07-15
        • 2010-09-13
        • 2015-12-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多