使用node.js和ldapjs进行LDAP绑定错误 [英] LDAP Bind Error using node.js and ldapjs
问题描述
我正在尝试使用以下node.js文件实现基本的ldap绑定。不幸的是,我不断收到代码128的绑定错误。我在网上查找并没有找到代码128的引用。我试图搜索的LDAP服务器是eDirectory。有没有人有这方面的经验或你有类似的问题?我的节点版本是v0.10.22,我的ldapjs版本是v0.7.1
I am trying to implement a basic ldap bind with the following node.js file. Unfortunately, I keep getting a bind error with code 128. I looked online and found no references of code 128. The LDAP server I am trying to search is an eDirectory. Does anyone have any experience with this or have you had similar problems? My node version is v0.10.22 and my ldapjs version is v0.7.1
var ldap = require('ldapjs');
var creds = {
url: "ldaps://ldap.url.com:636",
bindDN: "cn=ldap,o=com"
};
var opts = {
filter: "(cn=username)",
scope: "sub"
};
function authDN(client, dn, password, cb) {
client.bind(dn, password, function (err) {
client.unbind();
cb(err === null, err);
});
}
function output(res, err) {
if (res) {
console.log('success');
} else {
console.log(['Error',err.code, err.dn, err.message ]);
}
}
var client = ldap.createClient(creds);
authDN(client, '(cn=username)', 'password', output);
推荐答案
当我将以下内容添加到顶部时,我的档案:
This authenticates when i added the following to the top of my file:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
我还没有研究足够知道为什么会这样,但我在这里找到了这个答案: https://github.com/mikeal/request/issues/418
I haven't researched enough to know why this works but I found this answer here: https://github.com/mikeal/request/issues/418
这篇关于使用node.js和ldapjs进行LDAP绑定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!