Próbuję uwierzytelnić się na serwerze LDAP za pomocą paszportu-ldapauth i ekspresowego.nodejs paszport ldapauth "Nie można odczytać właściwości" na "nieokreślonej"
Uwierzytelnianie za pomocą LDAP URL (LDAP: // myserver ...) działa OK, ale z LDAPS uzyskać:
TypeError: Cannot read property 'on' of undefined at setupSocket (...\ldapauth-fork\node_modules\ldapjs\lib\client\client.js:111:14) at Client._connect (...\ldapauth-fork\node_modules\ldapjs\lib\client\client.js:742:3) at new Client (...\ldapauth-fork\node_modules\ldapjs\lib\client\client.js:247:22) at Object.createClient (...\ldapauth-fork\node_modules\ldapjs\lib\client\index.js:60:12) at new LdapAuth (...\ldapauth-fork\lib\ldapauth.js:129:28) at handleAuthentication (...\passport-ldapauth\lib\passport-ldapauth\strategy.js:140:10) at Strategy.authenticate (...\passport-ldapauth\lib\passport-ldapauth\strategy.js:175:33) at attempt (...\passport\lib\middleware\authenticate.js:341:16) at authenticate (...\passport\lib\middleware\authenticate.js:342:7) at Layer.handle [as handle_request] (...\express\lib\router\layer.js:82:5)
Moje kodu jest, w zasadzie, to:
...
passport.use(new LdapStrategy({
server: {
url: 'ldaps://myserver:636',
searchBase: '...',
searchFilter: '(uid={{username}})',
tlsOptions: {
ca: [
fs.readFileSync('myCAcert.pem')
]
}
},
session: false,
usernameField:'u',
passwordField:'p'
},
function(user, done) {
console.log("Interna: \nOK");
console.log("u:");
console.log(user.cn);
return done(null, user);
}));
app.use('/login',passport.authenticate('ldapauth',
{ session:false,
successRedirect:'/accessed',
failureRedirect: '/accessfail'
}
));
app.use('/accessed',function (req,res,next){
res.send("User OK");
});
app.use('/accessfail',function (req,res,next){
res.send("User MAL !!!!!!!");
});
app.listen(3336);
Moje wersje bibliotek to:
[email protected], [email protected],[email protected]
Ktoś może mi pomóc?
Dzięki.
Ten sam problem tutaj. Dziękuję za poprawkę. Zobacz https://github.com/vesse/node-ldapauth-fork/pull/18 – mjhasbach