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

This commit is contained in:
Shinsuke Sugaya 2016-02-16 23:39:04 +09:00
parent 74613166da
commit 655f455526
5 changed files with 13 additions and 18 deletions

View file

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

View file

@ -30,6 +30,8 @@ public class User extends BsUser implements FessUser {
private static final long serialVersionUID = 1L;
private String originalPassword;
public Long getVersionNo() {
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) + "]";
}
public void setOriginalPassword(String originalPassword) {
this.originalPassword = originalPassword;
}
public String getOriginalPassword() {
return originalPassword;
}
}

View file

@ -41,7 +41,6 @@ import org.codelibs.fess.helper.SambaHelper;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
import org.dbflute.optional.OptionalEntity;
import org.lastaflute.core.security.PrimaryCipher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -196,10 +195,9 @@ public class LdapManager {
}
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("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) {

View file

@ -650,9 +650,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. groupOfNames */
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}.
* @param propertyKey The key of the property. (NotNull)
@ -2586,13 +2583,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
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.
* @author FreeGen
@ -3601,9 +3591,5 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
public String getLdapAdminGroupObjectClasses() {
return get(FessConfig.LDAP_ADMIN_GROUP_OBJECT_CLASSES);
}
public String getLdapAdminDigestAlgorismPrefix() {
return get(FessConfig.LDAP_ADMIN_DIGEST_ALGORISM_PREFIX);
}
}
}

View file

@ -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.group.security.principal=cn\=%s,ou\=Group,dc\=fess,dc\=codelibs,dc\=org
ldap.admin.group.object.classes=groupOfNames
ldap.admin.digest.algorism.prefix={SHA256}