mirror of https://gitee.com/stylefeng/roses
【7.0.2】删除sql,去除没用配置
parent
507408463a
commit
bb8dfbb659
|
@ -134,24 +134,6 @@ public class AuthConfigExpander {
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_PARAM_NAME", String.class, DEFAULT_AUTH_PARAM_NAME);
|
return ConfigContext.me().getSysConfigValueWithDefault("SYS_AUTH_PARAM_NAME", String.class, DEFAULT_AUTH_PARAM_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 会话信息是否增加保存在 cookie 中
|
|
||||||
* <p>
|
|
||||||
* 如果开启此开关,会发生两件事:
|
|
||||||
* <p>
|
|
||||||
* 1.则登录过程中创建会话时,会HttpServletResponse对象进行addCookie()操作
|
|
||||||
* <p>
|
|
||||||
* 2.获取当前用户token会多一个从cookie中获取token这个方式
|
|
||||||
* <p>
|
|
||||||
* 一般这个开关的开启,用在单体不分离的版本中
|
|
||||||
*
|
|
||||||
* @author fengshuonan
|
|
||||||
* @date 2020/12/27 13:15
|
|
||||||
*/
|
|
||||||
public static Boolean getSessionAddToCookie() {
|
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SESSION_ADD_TO_COOKIE", Boolean.class, Boolean.FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会话保存在cookie中时,cooke的name
|
* 会话保存在cookie中时,cooke的name
|
||||||
*
|
*
|
||||||
|
|
|
@ -72,17 +72,15 @@ public class LoginUserImpl implements LoginUserApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 从cookie中获取token
|
// 3. 从cookie中获取token
|
||||||
if (AuthConfigExpander.getSessionAddToCookie()) {
|
String sessionCookieName = AuthConfigExpander.getSessionCookieName();
|
||||||
String sessionCookieName = AuthConfigExpander.getSessionCookieName();
|
Cookie[] cookies = request.getCookies();
|
||||||
Cookie[] cookies = request.getCookies();
|
if (cookies != null && cookies.length > 0) {
|
||||||
if (cookies != null && cookies.length > 0) {
|
for (Cookie cookie : cookies) {
|
||||||
for (Cookie cookie : cookies) {
|
|
||||||
|
|
||||||
// 如果cookie有对应的值,并且不为空
|
// 如果cookie有对应的值,并且不为空
|
||||||
if (sessionCookieName.equals(cookie.getName())
|
if (sessionCookieName.equals(cookie.getName())
|
||||||
&& StrUtil.isNotBlank(cookie.getValue())) {
|
&& StrUtil.isNotBlank(cookie.getValue())) {
|
||||||
return cookie.getValue();
|
return cookie.getValue();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,12 +193,10 @@ public class DefaultSessionManager implements SessionManagerApi {
|
||||||
@Override
|
@Override
|
||||||
public void destroySessionCookie() {
|
public void destroySessionCookie() {
|
||||||
// 如果开启了cookie存储会话信息,则需要给HttpServletResponse添加一个cookie
|
// 如果开启了cookie存储会话信息,则需要给HttpServletResponse添加一个cookie
|
||||||
if (AuthConfigExpander.getSessionAddToCookie()) {
|
String sessionCookieName = AuthConfigExpander.getSessionCookieName();
|
||||||
String sessionCookieName = AuthConfigExpander.getSessionCookieName();
|
Cookie cookie = sessionCookieCreator.createCookie(sessionCookieName, null, 0);
|
||||||
Cookie cookie = sessionCookieCreator.createCookie(sessionCookieName, null, 0);
|
HttpServletResponse response = HttpServletUtil.getResponse();
|
||||||
HttpServletResponse response = HttpServletUtil.getResponse();
|
response.addCookie(cookie);
|
||||||
response.addCookie(cookie);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,15 +0,0 @@
|
||||||
-- 分离版本唯一区别是这个配置的值是false
|
|
||||||
UPDATE `sys_config`
|
|
||||||
SET `config_name` = '会话信息是否增加保存在cookie中',
|
|
||||||
`config_code` = 'SYS_SESSION_ADD_TO_COOKIE',
|
|
||||||
`config_value` = 'false',
|
|
||||||
`sys_flag` = 'Y',
|
|
||||||
`remark` = NULL,
|
|
||||||
`status_flag` = 1,
|
|
||||||
`group_code` = 'auth_config',
|
|
||||||
`del_flag` = 'N',
|
|
||||||
`create_time` = NULL,
|
|
||||||
`create_user` = NULL,
|
|
||||||
`update_time` = NULL,
|
|
||||||
`update_user` = NULL
|
|
||||||
WHERE `config_id` = 13;
|
|
Loading…
Reference in New Issue