Browse Source

generalized promisifiedPassportAuthentication

sou 7 years ago
parent
commit
a9e0158738
1 changed files with 5 additions and 5 deletions
  1. 5 5
      lib/routes/login-passport.js

+ 5 - 5
lib/routes/login-passport.js

@@ -82,6 +82,11 @@ module.exports = function(crowi, app) {
     const strategyName = 'ldapauth';
     const ldapAccountInfo = await promisifiedPassportAuthentication(req, res, next, strategyName);
 
+    // check groups for LDAP
+    if (!isValidLdapUserByGroupFilter(ldapAccountInfo)) {
+      return loginFailure(req, res, next);
+    }
+
     /*
       * authentication success
       */
@@ -244,11 +249,6 @@ module.exports = function(crowi, app) {
           return next();
         }
 
-        // check groups for LDAP user
-        if (!isValidLdapUserByGroupFilter(response)) {
-          return loginFailure(req, res, next);
-        }
-
         resolve(response)
       })(req, res, next);
     });