node-activedirectory icon indicating copy to clipboard operation
node-activedirectory copied to clipboard

invalid DN

Open cedricbieder opened this issue 2 years ago • 1 comments

I set up an univention ldap server and try to connect to it with my nodejs server. For that I first tried the ldap-authentication ldap-authentication package which works fine with the following config:

await authenticate({
    ldapOpts: { url: ip },
    userDn: 'uid=Administrator,cn=users,dc=example,dc=intranet',
    userPassword: 'password',
    userSearchBase: 'dc=example,dc=intranet',
    username: 'Administrator',
})

Because I need some more functions I tried activedirectory with the following config (and some others but nothing worked):


var ActiveDirectory = require('activedirectory');
var config = { url: ip,
  bindDN: 'uid=Administrator,cn=users,dc=example,dc=intranet',
  baseDN: 'dc=example,dc=intranet',
  username: 'Administrator',
  password: 'password' 
}

var ad = new ActiveDirectory(config)
var username = 'Administrator';
var password = 'password';

ad.authenticate(username, password, function(err, auth) {
 if (err) {
    console.log('ERROR: ' + JSON.stringify(err));
    return;
 }
 if (auth) {
    console.log('Authenticated!');
 } else {
    console.log('Authentication failed!');
 }
});

For me both should work the same way, but the activedirectory-package just throws:

ERROR: {"lde_message":"invalid DN","lde_dn":null}

Also theldapsearch -H ip -x -D "uid=Administrator,cn=users,dc=example,dc=intranet" -W password -b "dc=example,dc=intranet"works fine.

So, what can be reason or way to solve this?

cedricbieder avatar Oct 28 '22 16:10 cedricbieder

Hi!

I have the same question! Any idea bout that?

goddensys avatar Dec 26 '22 20:12 goddensys