|
@@ -34,6 +34,9 @@ public class RedisSessionConfig { |
|
|
@Value("${nd.cache.def.keyPrefix:}") |
|
|
@Value("${nd.cache.def.keyPrefix:}") |
|
|
private String keyPrefix; |
|
|
private String keyPrefix; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${cookie.path}") |
|
|
|
|
|
private String cookiePath; |
|
|
|
|
|
|
|
|
public String getRedisNamespace() { |
|
|
public String getRedisNamespace() { |
|
|
return (StrUtil.isBlank(keyPrefix) ? StrPool.EMPTY : keyPrefix + StrPool.COLON) + RedisIndexedSessionRepository.DEFAULT_NAMESPACE; |
|
|
return (StrUtil.isBlank(keyPrefix) ? StrPool.EMPTY : keyPrefix + StrPool.COLON) + RedisIndexedSessionRepository.DEFAULT_NAMESPACE; |
|
|
} |
|
|
} |
|
@@ -45,6 +48,7 @@ public class RedisSessionConfig { |
|
|
// 创建 DefaultCookieSerializer 对象 |
|
|
// 创建 DefaultCookieSerializer 对象 |
|
|
DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); |
|
|
DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); |
|
|
cookieSerializer.setCookieName(BizConst.COOKIE_KEY); |
|
|
cookieSerializer.setCookieName(BizConst.COOKIE_KEY); |
|
|
|
|
|
cookieSerializer.setCookiePath(cookiePath); |
|
|
cookieSerializer.setCookieMaxAge(AuthConst.SESSION_TIME_SECONDS); |
|
|
cookieSerializer.setCookieMaxAge(AuthConst.SESSION_TIME_SECONDS); |
|
|
// 设置到 sessionIdResolver 中 |
|
|
// 设置到 sessionIdResolver 中 |
|
|
sessionIdResolver.setCookieSerializer(cookieSerializer); |
|
|
sessionIdResolver.setCookieSerializer(cookieSerializer); |
|
|