【8.0】【auth】整理登录相关配置位置

pull/57/head
fengshuonan 2023-10-03 20:34:06 +08:00
parent c227eb1524
commit 956d50850c
4 changed files with 29 additions and 29 deletions

View File

@ -101,19 +101,6 @@ public class AuthConfigExpander {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SESSION_EXPIRED_SECONDS", Long.class, 3600L);
}
/**
*
* <p>
*
*
* @return true-false-
* @author fengshuonan
* @since 2020/10/21 14:31
*/
public static boolean getSingleAccountLoginFlag() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SINGLE_ACCOUNT_LOGIN_FLAG", Boolean.class, false);
}
/**
* jwtssotoken
*
@ -205,16 +192,4 @@ public class AuthConfigExpander {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_SSO_HOST", String.class, SYS_AUTH_SSO_HOST);
}
/**
* RSA
* <p>
*
*
* @author fengshuonan
* @since 2022/10/16 23:28
*/
public static Boolean getPasswordRsaValidateFlag() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_PASSWORD_RSA_VALIDATE", Boolean.class, false);
}
}

View File

@ -23,4 +23,29 @@ public class LoginConfigExpander {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_LOGIN_MAX_ERROR_LOGIN_COUNT", Integer.class, LoginCacheConstants.MAX_ERROR_LOGIN_COUNT);
}
/**
*
* <p>
*
*
* @return true-false-
* @author fengshuonan
* @since 2020/10/21 14:31
*/
public static boolean getSingleAccountLoginFlag() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SINGLE_ACCOUNT_LOGIN_FLAG", Boolean.class, false);
}
/**
* RSA
* <p>
*
*
* @author fengshuonan
* @since 2022/10/16 23:28
*/
public static Boolean getPasswordRsaValidateFlag() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_PASSWORD_RSA_VALIDATE", Boolean.class, false);
}
}

View File

@ -163,7 +163,7 @@ public class LoginService {
sessionManagerApi.createSession(userLoginToken, loginUser);
// 11. 如果开启了单账号单端在线,则踢掉已经上线的该用户
if (AuthConfigExpander.getSingleAccountLoginFlag()) {
if (LoginConfigExpander.getSingleAccountLoginFlag()) {
sessionManagerApi.removeSessionExcludeToken(userLoginToken);
}
}
@ -191,7 +191,7 @@ public class LoginService {
* @since 2023/6/20 23:15
*/
private void decryptRequestPassword(LoginRequest loginRequest) {
if (loginRequest.getPassword() != null && AuthConfigExpander.getPasswordRsaValidateFlag()) {
if (loginRequest.getPassword() != null && LoginConfigExpander.getPasswordRsaValidateFlag()) {
String decryptPassword = passwordTransferEncryptApi.decrypt(loginRequest.getPassword());
loginRequest.setPassword(decryptPassword);
}

View File

@ -12,7 +12,7 @@ import cn.stylefeng.roses.kernel.auth.api.context.AuthJwtContext;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.exception.AuthException;
import cn.stylefeng.roses.kernel.auth.api.exception.enums.AuthExceptionEnum;
import cn.stylefeng.roses.kernel.auth.api.expander.AuthConfigExpander;
import cn.stylefeng.roses.kernel.auth.api.expander.LoginConfigExpander;
import cn.stylefeng.roses.kernel.auth.api.password.PasswordStoredEncryptApi;
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
@ -211,7 +211,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
sessionManagerApi.createSession(jwtToken, loginUser);
// 如果开启了单账号单端在线,则踢掉已经上线的该用户
if (AuthConfigExpander.getSingleAccountLoginFlag()) {
if (LoginConfigExpander.getSingleAccountLoginFlag()) {
sessionManagerApi.removeSessionExcludeToken(jwtToken);
}
}