I wish to implement a login mechanism to my App, as the users are sitting in LDAP server, and not in local DB.
Iv'e been thinking about implementing it passport.js, but i'm trying to figure out the other part of the solution- I can choose passport-ldap, OR I can try... to implement the solution with "local" strategy:
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
if (!user.verifyPassword(password)) { return done(null, false); }
return done(null, user);
});
}
));
Where as the function(user, password, done)
might be implanted ldapjs.
I'm not sure which option will work better. I think that the second might give me more control of the login process, but using LDAP strategy might make a bit more sense.
Any suggestions?