Merge pull request #279 from alecdwm/ldap-auth

Support for LDAP server authentication
This commit is contained in:
Max Wu
2017-01-09 00:49:40 +08:00
committed by GitHub
11 changed files with 191 additions and 6 deletions

12
app.js
View File

@@ -381,6 +381,18 @@ if (config.google) {
failureRedirect: config.serverurl + '/'
}));
}
// ldap auth
if (config.ldap) {
app.post('/auth/ldap', urlencodedParser, function (req, res, next) {
if (!req.body.username || !req.body.password) return response.errorBadRequest(res);
setReturnToFromReferer(req);
passport.authenticate('ldapauth', {
successReturnToOrRedirect: config.serverurl + '/',
failureRedirect: config.serverurl + '/',
failureFlash: true
})(req, res, next);
});
}
// email auth
if (config.email) {
app.post('/register', urlencodedParser, function (req, res, next) {