mirror of https://gitee.com/stylefeng/roses
【8.0】【auth】移除auth模块的两个配置
parent
0d46cba194
commit
ff527561d9
|
@ -114,36 +114,6 @@ public class AuthConfigExpander {
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SINGLE_ACCOUNT_LOGIN_FLAG", Boolean.class, false);
|
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SINGLE_ACCOUNT_LOGIN_FLAG", Boolean.class, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取携带token的header头的名称
|
|
||||||
*
|
|
||||||
* @author fengshuonan
|
|
||||||
* @since 2020/10/22 14:11
|
|
||||||
*/
|
|
||||||
public static String getAuthTokenHeaderName() {
|
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_HEADER_NAME", String.class, DEFAULT_AUTH_HEADER_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取携带token的param传参的名称
|
|
||||||
*
|
|
||||||
* @author fengshuonan
|
|
||||||
* @since 2020/10/22 14:11
|
|
||||||
*/
|
|
||||||
public static String getAuthTokenParamName() {
|
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_PARAM_NAME", String.class, DEFAULT_AUTH_PARAM_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会话保存在cookie中时,cooke的name
|
|
||||||
*
|
|
||||||
* @author fengshuonan
|
|
||||||
* @since 2020/12/27 13:18
|
|
||||||
*/
|
|
||||||
public static String getSessionCookieName() {
|
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SESSION_COOKIE_NAME", String.class, DEFAULT_AUTH_HEADER_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认解析jwt的秘钥(用于解析sso传过来的token)
|
* 默认解析jwt的秘钥(用于解析sso传过来的token)
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package cn.stylefeng.roses.kernel.auth.api.loginuser;
|
package cn.stylefeng.roses.kernel.auth.api.loginuser;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.stylefeng.roses.kernel.auth.api.constants.AuthConstants;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.exception.AuthException;
|
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.exception.enums.AuthExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.expander.AuthConfigExpander;
|
|
||||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -28,7 +28,7 @@ public class CommonLoginUserUtil {
|
||||||
HttpServletRequest request = HttpServletUtil.getRequest();
|
HttpServletRequest request = HttpServletUtil.getRequest();
|
||||||
|
|
||||||
// 1. 优先从param参数中获取token
|
// 1. 优先从param参数中获取token
|
||||||
String parameterToken = request.getParameter(AuthConfigExpander.getAuthTokenParamName());
|
String parameterToken = request.getParameter(AuthConstants.DEFAULT_AUTH_PARAM_NAME);
|
||||||
|
|
||||||
// 不为空则直接返回param的token
|
// 不为空则直接返回param的token
|
||||||
if (StrUtil.isNotBlank(parameterToken)) {
|
if (StrUtil.isNotBlank(parameterToken)) {
|
||||||
|
@ -36,7 +36,7 @@ public class CommonLoginUserUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 从header中获取token
|
// 2. 从header中获取token
|
||||||
String authToken = request.getHeader(AuthConfigExpander.getAuthTokenHeaderName());
|
String authToken = request.getHeader(AuthConstants.DEFAULT_AUTH_HEADER_NAME);
|
||||||
if (StrUtil.isNotBlank(authToken)) {
|
if (StrUtil.isNotBlank(authToken)) {
|
||||||
return authToken;
|
return authToken;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
delete from sys_config where config_code = 'SYS_AUTH_PARAM_NAME';
|
||||||
|
delete from sys_config where config_code = 'SYS_AUTH_HEADER_NAME';
|
||||||
|
delete from sys_config where config_code = 'SYS_SESSION_COOKIE_NAME';
|
Loading…
Reference in New Issue