This is how i set up my passport-ldapauth strategy:
let OPT = {
server: {
url: 'ldap://****:389',
bindDN: "",
bindCredentials: "",
searchBase: 'ou=Users,dc=astron,dc=hu',
searchFilter: "(uid={{username}})"
},
usernameField: 'username',
passwordField: 'password',
};
passport.use(new LdapStrategy(OPT, function (user, done) {
if (user != null) {
return done(null, user);
} else return done(new Error("i dont know"), null)
}))
app.use(passport.initialize())
This is where is use it:
async authenticate(req, res): Promise < boolean > {
return new Promise < boolean > ((resolve,
reject) => {
let authenticate: express.RequestHandler = <express.RequestHandler>passport.authenticate('ldapauth', (error, user, info) => {
if (error) {
return reject(error);
}
if (!user) {
return resolve(false);
}
req.user = user;
resolve(true);
});
authenticate(req, res,
null);
}
)
}
And i get this error:
Error: getaddrinfo ENOTFOUND **** ****:389
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
My question would be why do i get the error? I am sure the url and the username/password is correct.