mirror of https://gitee.com/stylefeng/roses
【7.3.2】【auth】更新回话管理逻辑
parent
88903ab02d
commit
385f5fd783
|
@ -94,16 +94,19 @@ public class DefaultSessionManager implements SessionManagerApi, ConfigUpdateCal
|
||||||
@Override
|
@Override
|
||||||
public void createSession(String token, LoginUser loginUser, Boolean createCookie) {
|
public void createSession(String token, LoginUser loginUser, Boolean createCookie) {
|
||||||
|
|
||||||
|
CacheOperatorApi<LoginUser> tenantCacheProxy = TenantCacheProxyFactory.createTenantCacheProxy(loginUser.getTenantCode(), loginUserCache);
|
||||||
|
CacheOperatorApi<Set<String>> allPlaceLoginTokenCacheProxy = TenantCacheProxyFactory.createTenantCacheProxy(loginUser.getTenantCode(), allPlaceLoginTokenCache);
|
||||||
|
|
||||||
// 装配用户信息的缓存
|
// 装配用户信息的缓存
|
||||||
loginUserCache.put(token, loginUser, sessionExpiredSeconds);
|
tenantCacheProxy.put(token, loginUser, sessionExpiredSeconds);
|
||||||
|
|
||||||
// 装配用户token的缓存
|
// 装配用户token的缓存
|
||||||
Set<String> theUserTokens = allPlaceLoginTokenCache.get(loginUser.getUserId().toString());
|
Set<String> theUserTokens = allPlaceLoginTokenCacheProxy.get(loginUser.getUserId().toString());
|
||||||
if (theUserTokens == null) {
|
if (theUserTokens == null) {
|
||||||
theUserTokens = new HashSet<>();
|
theUserTokens = new HashSet<>();
|
||||||
}
|
}
|
||||||
theUserTokens.add(token);
|
theUserTokens.add(token);
|
||||||
allPlaceLoginTokenCache.put(loginUser.getUserId().toString(), theUserTokens);
|
allPlaceLoginTokenCacheProxy.put(loginUser.getUserId().toString(), theUserTokens);
|
||||||
|
|
||||||
// 如果开启了cookie存储会话信息,则需要给HttpServletResponse添加一个cookie
|
// 如果开启了cookie存储会话信息,则需要给HttpServletResponse添加一个cookie
|
||||||
if (createCookie) {
|
if (createCookie) {
|
||||||
|
|
Loading…
Reference in New Issue