Kaynağa Gözat

#361 remove ldap.admin.digest.algorism.prefix

Shinsuke Sugaya 9 yıl önce
ebeveyn
işleme
655f455526

+ 1 - 0
src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java

@@ -270,6 +270,7 @@ public class AdminUserAction extends FessAdminAction {
             copyBeanToBean(form, entity, op -> op.exclude(ArrayUtils.addAll(Constants.COMMON_CONVERSION_RULE, "password")));
             copyBeanToBean(form, entity, op -> op.exclude(ArrayUtils.addAll(Constants.COMMON_CONVERSION_RULE, "password")));
             if (form.crudMode.intValue() == CrudMode.CREATE || StringUtil.isNotBlank(form.password)) {
             if (form.crudMode.intValue() == CrudMode.CREATE || StringUtil.isNotBlank(form.password)) {
                 final String encodedPassword = fessLoginAssist.encryptPassword(form.password);
                 final String encodedPassword = fessLoginAssist.encryptPassword(form.password);
+                entity.setOriginalPassword(form.password);
                 entity.setPassword(encodedPassword);
                 entity.setPassword(encodedPassword);
             }
             }
             return entity;
             return entity;

+ 11 - 0
src/main/java/org/codelibs/fess/es/user/exentity/User.java

@@ -30,6 +30,8 @@ public class User extends BsUser implements FessUser {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
+    private String originalPassword;
+
     public Long getVersionNo() {
     public Long getVersionNo() {
         return asDocMeta().version();
         return asDocMeta().version();
     }
     }
@@ -63,4 +65,13 @@ public class User extends BsUser implements FessUser {
         return "User [name=" + name + ", roles=" + Arrays.toString(roles) + ", groups=" + Arrays.toString(groups) + "]";
         return "User [name=" + name + ", roles=" + Arrays.toString(roles) + ", groups=" + Arrays.toString(groups) + "]";
     }
     }
 
 
+    public void setOriginalPassword(String originalPassword) {
+        this.originalPassword = originalPassword;
+
+    }
+
+    public String getOriginalPassword() {
+        return originalPassword;
+    }
+
 }
 }

+ 1 - 3
src/main/java/org/codelibs/fess/ldap/LdapManager.java

@@ -41,7 +41,6 @@ import org.codelibs.fess.helper.SambaHelper;
 import org.codelibs.fess.mylasta.direction.FessConfig;
 import org.codelibs.fess.mylasta.direction.FessConfig;
 import org.codelibs.fess.util.ComponentUtil;
 import org.codelibs.fess.util.ComponentUtil;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalEntity;
-import org.lastaflute.core.security.PrimaryCipher;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
@@ -196,10 +195,9 @@ public class LdapManager {
     }
     }
 
 
     protected void addUserAttributes(final BasicAttributes entry, final User user, final FessConfig fessConfig) {
     protected void addUserAttributes(final BasicAttributes entry, final User user, final FessConfig fessConfig) {
-        final PrimaryCipher cipher = ComponentUtil.getComponent(PrimaryCipher.class);
         entry.put(new BasicAttribute("cn", user.getName()));
         entry.put(new BasicAttribute("cn", user.getName()));
         entry.put(new BasicAttribute("sn", user.getName()));
         entry.put(new BasicAttribute("sn", user.getName()));
-        entry.put(new BasicAttribute("userPassword", fessConfig.getLdapAdminDigestAlgorismPrefix() + cipher.oneway(user.getPassword())));
+        entry.put(new BasicAttribute("userPassword", user.getOriginalPassword()));
     }
     }
 
 
     public void delete(User user) {
     public void delete(User user) {

+ 0 - 14
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -650,9 +650,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. groupOfNames */
     /** The key of the configuration. e.g. groupOfNames */
     String LDAP_ADMIN_GROUP_OBJECT_CLASSES = "ldap.admin.group.object.classes";
     String LDAP_ADMIN_GROUP_OBJECT_CLASSES = "ldap.admin.group.object.classes";
 
 
-    /** The key of the configuration. e.g. {SHA256} */
-    String LDAP_ADMIN_DIGEST_ALGORISM_PREFIX = "ldap.admin.digest.algorism.prefix";
-
     /**
     /**
      * Get the value of property as {@link String}.
      * Get the value of property as {@link String}.
      * @param propertyKey The key of the property. (NotNull)
      * @param propertyKey The key of the property. (NotNull)
@@ -2586,13 +2583,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
      */
     String getLdapAdminGroupObjectClasses();
     String getLdapAdminGroupObjectClasses();
 
 
-    /**
-     * Get the value for the key 'ldap.admin.digest.algorism.prefix'. <br>
-     * The value is, e.g. {SHA256} <br>
-     * @return The value of found property. (NotNull: if not found, exception but basically no way)
-     */
-    String getLdapAdminDigestAlgorismPrefix();
-
     /**
     /**
      * The simple implementation for configuration.
      * The simple implementation for configuration.
      * @author FreeGen
      * @author FreeGen
@@ -3601,9 +3591,5 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
         public String getLdapAdminGroupObjectClasses() {
         public String getLdapAdminGroupObjectClasses() {
             return get(FessConfig.LDAP_ADMIN_GROUP_OBJECT_CLASSES);
             return get(FessConfig.LDAP_ADMIN_GROUP_OBJECT_CLASSES);
         }
         }
-
-        public String getLdapAdminDigestAlgorismPrefix() {
-            return get(FessConfig.LDAP_ADMIN_DIGEST_ALGORISM_PREFIX);
-        }
     }
     }
 }
 }

+ 0 - 1
src/main/resources/fess_config.properties

@@ -362,5 +362,4 @@ ldap.admin.role.security.principal=cn\=%s,ou\=Role,dc\=fess,dc\=codelibs,dc\=org
 ldap.admin.role.object.classes=groupOfNames
 ldap.admin.role.object.classes=groupOfNames
 ldap.admin.group.security.principal=cn\=%s,ou\=Group,dc\=fess,dc\=codelibs,dc\=org
 ldap.admin.group.security.principal=cn\=%s,ou\=Group,dc\=fess,dc\=codelibs,dc\=org
 ldap.admin.group.object.classes=groupOfNames
 ldap.admin.group.object.classes=groupOfNames
-ldap.admin.digest.algorism.prefix={SHA256}