簡體   English   中英

如何在PHP中啟用LDAP身份驗證

[英]How to enable LDAP authentication in PHP

我有一台服務器(Windows Server 2012 R2),需要在PHP中配置LDAP用戶身份驗證。 服務器是域控制器,已安裝PHP(5.6),PHP已經具有LDAP擴展名。 與ldp.exe中的憑據綁定有效。

我知道的:

  • LDAP連接有效
  • 我可以匿名登錄
  • 我無法使用用戶憑據(甚至使用管理員憑據)登錄
  • 我嘗試了編輯策略“默認域控制器”

域控制器:LDAP服務器簽名要求

沒有

網絡安全:LDAP客戶端簽名要求

協商簽名

PHP代碼:

// using ldap bind
$ldaprdn  = 'bigboss';     // ldap rdn or dn
$ldappass = 'AdmiN123';  // associated password

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

if ($ldapconn) {
    // binding to ldap server
    $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
    // verify binding
    if ($ldapbind) {
        echo "LDAP bind successful...";
    } else {
        echo "LDAP bind failed...";
    }   
}

我的錯,我需要編輯

$ldaprdn  = 'bigboss'

$ldaprdn  = '[domain name]\bigboss'

謝謝

暫無
暫無

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

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