使用Codeigniter Library进行Active Directory身份验证

时间:2015-02-19 12:02:31

标签: php active-directory ldap codeigniter-2

我正在使用来自auth_ldap_library的Greg Wojtak编写的Codeigniter的ldap库。

我按照说明设置了配置。但是,当我尝试使用我的用户名和密码进行身份验证时,我收到错误(ldap_bind()无法绑定)。

以下是配置

$config['ldap_uri'] = array('ldaps://dc1.mycompany.com/', 'ldaps://dc2.mycompany.com/');
$config['use_tls'] = false;  // Using SSL above, don't use TLS with it
$config['search_base'] = 'DC=mycompany,DC=com';
$config['user_search_base'] = 'CN=Users,DC=mycompany,DC=com';
$config['group_search_base'] = 'CN=Users,DC=mycompany,DC=com';
$config['user_object_class'] = 'user';
$config['group_object_class'] = 'group';
$config['user_search_filter'] = '';
$config['group_search_filter'] = '';
$config['login_attribute'] = 'sAMAccountName';
$config['schema_type'] = 'ad'; // Could also use rfc2307bis
$config['proxy_user'] = '';  // Or CN=ProxyUser,CN=Users,DC=mycompany,DC=com
$config['proxy_pass'] = '';
$config['roles'] = array(1 => 'User', 
                    3 => 'Power User',
                    5 => 'Administrator');
$config['auditlog'] = 'application/logs/audit.log';

这是我收到错误的行"错误查找DN用户名"

第217行是foreach行

   foreach($this->user_search_base as $usb) {
   $search = ldap_search($this->ldapconn, $usb, $filter, 
            array('dn', $this->login_attribute, 'cn'));
        $entries = ldap_get_entries($this->ldapconn, $search);
        if(isset($entries[0]['dn'])) {
            $binddn = $entries[0]['dn'];
            break;
        }
    }

错误信息如下。

Error Message

有没有人遇到过类似的问题?

0 个答案:

没有答案