Yuki Takei 8 лет назад
Родитель
Сommit
d6b9ad884a
1 измененных файлов с 16 добавлено и 11 удалено
  1. 16 11
      lib/service/passport.js

+ 16 - 11
lib/service/passport.js

@@ -22,7 +22,7 @@ class PassportService {
    * @memberof PassportService
    */
   setupLocalStrategy() {
-    debug('setup LocalStrategy');
+    debug('LocalStrategy: setting up..');
 
     const User = this.crowi.model('User');
 
@@ -43,13 +43,14 @@ class PassportService {
         });
       }
     ));
+    debug('LocalStrategy: setup is done');
   }
 
   /*
    * Asynchronous configuration retrieval
    */
   setupLdapStrategy() {
-    debug('setup LdapStrategy');
+    debug('LdapStrategy: setting up..');
 
     const config = this.crowi.config;
 
@@ -64,21 +65,23 @@ class PassportService {
     // see: https://regex101.com/r/0tuYBB/1
     const match = serverUrl.match(/(ldaps?:\/\/[^\/]+)\/(.*)?/);
     if (match == null || match.length < 1) {
-      debug('serverUrl is invalid');
+      debug('LdapStrategy: serverUrl is invalid');
       return;
     }
     const url = match[1];
     const searchBase = match[2] || '';
 
-    debug(`LDAP url:             ${url}`);
-    debug(`LDAP searchBase:      ${searchBase}`);
-    debug(`LDAP isUserBind:      ${isUserBind}`);
-    debug(`LDAP bindDN:          ${bindDN}`);
-    debug(`LDAP bindCredentials: ${bindCredentials}`);
-    debug(`LDAP searchFilter:    ${searchFilter}`);
+    debug(`LdapStrategy: url=${url}`);
+    debug(`LdapStrategy: searchBase=${searchBase}`);
+    debug(`LdapStrategy: isUserBind=${isUserBind}`);
+    if (!isUserBind) {
+      debug(`LdapStrategy: bindDN=${bindDN}`);
+      debug(`LdapStrategy: bindCredentials=${bindCredentials}`);
+    }
+    debug(`LdapStrategy searchFilter:    ${searchFilter}`);
 
     // Asynchronous configuration retrieval
-    var getLDAPConfiguration = (req, callback) => {
+    const getLDAPConfiguration = (req, callback) => {
       // get credentials from form data
       const loginForm = req.body.loginForm;
       if (!req.form.isValid) {
@@ -116,6 +119,8 @@ class PassportService {
         return done(null, user);
       }
     ));
+
+    debug('LdapStrategy: setup is done');
   }
 
   /**
@@ -124,7 +129,7 @@ class PassportService {
    * @memberof PassportService
    */
   setupSerializer() {
-    debug('setup serializer and deserializer');
+    debug('setting up serializer and deserializer');
 
     const User = this.crowi.model('User');