使用node.js和ldapjs进行LDAP绑定错误

Kai*_*elm 7 javascript ldap edirectory node.js

我正在尝试使用以下node.js文件实现基本的ldap绑定.不幸的是,我不断收到代码128的绑定错误.我在网上查找并没有找到代码128的引用.我试图搜索的LDAP服务器是eDirectory.有没有人有这方面的经验或你有类似的问题?我的节点版本是v0.10.22,我的ldapjs版本是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);
Run Code Online (Sandbox Code Playgroud)

Kai*_*elm 6

这在我将以下内容添加到文件顶部时进行身份验证:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
Run Code Online (Sandbox Code Playgroud)

我没有研究足够知道为什么这有效,但我在这里找到了这个答案:https://github.com/mikeal/request/issues/418