【发布时间】:2017-05-04 19:37:51
【问题描述】:
我正在使用这个 PHP 小脚本 (最小化 [正常工作] 来证明这一点) 来验证 AD 用户
define('WLU_LDAP_SERV', 'ldaps://test.domain.com:636');
define('WLU_LDAP_BASE', 'OU=Employees,OU=UsersGroups,DC=test,DC=domain,DC=com');
function ldapAuthentication($username, $password)
{
$response = array();
$err = array();
$filter = 'CN='.$username;
$dnbase = $filter . ',' . WLU_LDAP_BASE;
$fields = array("cn","mail","displayname");
$link = @ldap_connect(WLU_LDAP_SERV);
$bind = @ldap_bind($link, $dnbase, $password);
$resl = @ldap_search($link, WLU_LDAP_BASE, $filter, $fields);
if ($resl) {
$info = @ldap_get_entries($link, $resl);
}
return $info;
}
我正在尝试使用 .htaccess 文件复制相同的过程,但我的身份验证失败
AuthType Basic
AuthBasicProvider ldap
LDAPReferrals Off
AuthLDAPBindAuthoritative off
AuthLDAPURL ldaps://test.domain.com:636/OU=Employees,OU=UsersGroups,DC=test,DC=domain,DC=com
AuthLDAPBindDN CN=someusername,OU=Employees,OU=UsersGroups,DC=test,DC=domain,DC=com
AuthName "AD authentication"
Require ldap-user
我明白了
Authentication required!
This server could not verify that you are authorized to access the URL "/". You either supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
In case you are allowed to request the document, please check your user-id and password and try again.
If you think this is a server error, please contact the webmaster.
Error 401
【问题讨论】:
标签: php apache .htaccess active-directory ldap