我在使用 ldapjs lib连接LDAP服务器时遇到问题。出于某种原因,我无法使用我的凭据绑定到ldap服务器:
var ldap = require('ldapjs');
function authDN(dn, password, cb) {
var client = ldap.createClient({url: 'ldaps://myserver:1234'});
client.bind(dn, password, function (err) {
client.unbind();
cb(err === null, err);
});
}
function output(res, err) {
if (res) {
console.log('success');
} else {
console.log('failure' + err.message);
}
}
// should print "success"
authDN('CN=J33nn,OU=Members,DC=domains', 'password', output);
// should print "failure"
authDN('cn=user', 'badpasswd', output);
要完全确定我已经在LDAP中检查了我的 dn ,并使用python脚本测试了对LDAP的绑定,并且它有效。
任何想法有什么不对?
答案 0 :(得分:1)
可能是用户名格式错误或您的DN不正确,而不是
CN=J33nn,OU=Members,DC=domains
尝试使用:
J33nn@company.domain.com
或者您应该使用LDAP exlorer tool通过绑定到LDAP服务器来检查您的真实/正确的DN名称。