【8.0】【config】系统配置编码抽出常量

pull/57/head
fengshuonan 2023-10-04 22:36:05 +08:00
parent 13d8b973b6
commit 98a23380e0
1 changed files with 48 additions and 8 deletions

View File

@ -11,6 +11,46 @@ import cn.stylefeng.roses.kernel.config.api.context.ConfigContext;
*/ */
public class LoginConfigExpander { public class LoginConfigExpander {
/**
* code
*/
public static final String SYS_LOGIN_MAX_ERROR_LOGIN_COUNT = "SYS_LOGIN_MAX_ERROR_LOGIN_COUNT";
/**
* code
*/
public static final String SYS_LOGIN_MIN_PASSWORD_LENGTH = "SYS_LOGIN_MIN_PASSWORD_LENGTH";
/**
* code
*/
public static final String SYS_LOGIN_PASSWORD_MIN_SPECIAL_SYMBOL_COUNT = "SYS_LOGIN_PASSWORD_MIN_SPECIAL_SYMBOL_COUNT";
/**
* code
*/
public static final String SYS_LOGIN_PASSWORD_MIN_UPPER_CASE_COUNT = "SYS_LOGIN_PASSWORD_MIN_UPPER_CASE_COUNT";
/**
* code
*/
public static final String SYS_LOGIN_PASSWORD_MIN_LOWER_CASE_COUNT = "SYS_LOGIN_PASSWORD_MIN_LOWER_CASE_COUNT";
/**
* code
*/
public static final String SYS_LOGIN_PASSWORD_MIN_NUMBER_COUNT = "SYS_LOGIN_PASSWORD_MIN_NUMBER_COUNT";
/**
* code
*/
public static final String SYS_LOGIN_PASSWORD_MIN_UPDATE_DAYS = "SYS_LOGIN_PASSWORD_MIN_UPDATE_DAYS";
/**
* code
*/
public static final String SYS_LOGIN_PASSWORD_MIN_CANT_REPEAT_TIMES = "SYS_LOGIN_PASSWORD_MIN_CANT_REPEAT_TIMES";
/** /**
* *
* <p> * <p>
@ -46,7 +86,7 @@ public class LoginConfigExpander {
*/ */
public static Integer getMaxErrorLoginCount() { public static Integer getMaxErrorLoginCount() {
return ConfigContext.me() return ConfigContext.me()
.getSysConfigValueWithDefault("SYS_LOGIN_MAX_ERROR_LOGIN_COUNT", Integer.class, LoginCacheConstants.MAX_ERROR_LOGIN_COUNT); .getSysConfigValueWithDefault(SYS_LOGIN_MAX_ERROR_LOGIN_COUNT, Integer.class, LoginCacheConstants.MAX_ERROR_LOGIN_COUNT);
} }
/** /**
@ -56,7 +96,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 20:39 * @since 2023/10/3 20:39
*/ */
public static Integer getMinPasswordLength() { public static Integer getMinPasswordLength() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_MIN_PASSWORD_LENGTH", Integer.class, 6); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_MIN_PASSWORD_LENGTH, Integer.class, 6);
} }
/** /**
@ -66,7 +106,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 20:44 * @since 2023/10/3 20:44
*/ */
public static Integer getPasswordMinSpecialSymbolCount() { public static Integer getPasswordMinSpecialSymbolCount() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_PASSWORD_MIN_SPECIAL_SYMBOL_COUNT", Integer.class, 0); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_PASSWORD_MIN_SPECIAL_SYMBOL_COUNT, Integer.class, 0);
} }
/** /**
@ -76,7 +116,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 21:14 * @since 2023/10/3 21:14
*/ */
public static Integer getPasswordMinUpperCaseCount() { public static Integer getPasswordMinUpperCaseCount() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_PASSWORD_MIN_UPPER_CASE_COUNT", Integer.class, 0); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_PASSWORD_MIN_UPPER_CASE_COUNT, Integer.class, 0);
} }
/** /**
@ -86,7 +126,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 21:16 * @since 2023/10/3 21:16
*/ */
public static Integer getPasswordMinLowerCaseCount() { public static Integer getPasswordMinLowerCaseCount() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_PASSWORD_MIN_LOWER_CASE_COUNT", Integer.class, 0); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_PASSWORD_MIN_LOWER_CASE_COUNT, Integer.class, 0);
} }
/** /**
@ -96,7 +136,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 21:18 * @since 2023/10/3 21:18
*/ */
public static Integer getPasswordMinNumberCount() { public static Integer getPasswordMinNumberCount() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_PASSWORD_MIN_NUMBER_COUNT", Integer.class, 0); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_PASSWORD_MIN_NUMBER_COUNT, Integer.class, 0);
} }
/** /**
@ -106,7 +146,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 21:27 * @since 2023/10/3 21:27
*/ */
public static Integer getPasswordMinUpdateDays() { public static Integer getPasswordMinUpdateDays() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_PASSWORD_MIN_UPDATE_DAYS", Integer.class, 180); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_PASSWORD_MIN_UPDATE_DAYS, Integer.class, 180);
} }
/** /**
@ -116,7 +156,7 @@ public class LoginConfigExpander {
* @since 2023/10/3 21:50 * @since 2023/10/3 21:50
*/ */
public static Integer getPasswordMinCantRepeatTimes() { public static Integer getPasswordMinCantRepeatTimes() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_PASSWORD_MIN_CANT_REPEAT_TIMES", Integer.class, 0); return ConfigContext.me().getSysConfigValueWithDefault(SYS_LOGIN_PASSWORD_MIN_CANT_REPEAT_TIMES, Integer.class, 0);
} }
} }