Reputation: 28608
I am an LDAP newbie.
I am using nodejs's ldapauth and I keep getting 32 - No Such Object
.
Here is my code :
var LdapAuth = require('ldapauth');
var ldapOptions = {
"url":"ldap://my-host:389",
"adminDn" : "cn=manager,dc=guycrc,dc=com",
"adminPassword":"secret",
"searchBase":"ou=Engineering",
"searchFilter":"(uid={{username}})"
};
var ldapAuthClient = new LdapAuth( ldapOptions );
ldapAuthClient.authenticate('Dana', 'Dana',
function(err, result) {
if (err) {
console.log(['Error',err.code, err.dn, err.message ]);
} else {
console.log('Credentials valid = ' + result); // true or false
}
}
);
This is my LDAP info - what I think is relevant for the question
dn: cn=Dana,ou=people,dc=guycrc,dc=com
...
cn: Dana Dana
sn: Dana
uid: Dana
userpassword: Dana
ou: Engineering
dn: cn=CompanyA,ou=groups,dc=guycrc,dc=com
...
cn: CompanyA
ou: Groups
member: cn=Dana,ou=people,dc=guycrc,dc=com
Why am I getting No Such Object
all the time?
Upvotes: 1
Views: 1748
Reputation: 11134
The search base object ou=engineering
is probably not what is intended, that value does not look like a DN, but rather like an RDN. Use the complete and correct search base object, which will be a DN superior to the objects for which the client searches.
Upvotes: 2
Reputation: 4100
Not being sure what the .authenticate
is meant to do in your line:
ldapAuthClient.authenticate('Dana', 'Dana',
I would guess that the data passed is not sufficient to find the required object, per the error.
Looking at your defined options:
"searchBase":"ou=Engineering",
"searchFilter":"(uid={{username}})"
Means that it is looking in the ou=engineering container. And looking for a uid that matches username, so probably the 'Dana' as the uid part is correct.
But since your LDIF shows Dana with the DN:
dn: cn=Dana,ou=people,dc=guycrc,dc=com
Not in an ou=engineering.
Perhaps it as simple as changing your searchBase to ou=people,dc=guycrc,dc=com
Upvotes: 2