簡體   English   中英

ldap身份驗證-活動目錄和php

[英]ldap authentication - active directory and php

我已經看到許多與通過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)完成,但要確保用戶名和密碼值不為空

希望它可以幫助別人。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM