【7.3.2】【auth】更新回话管理逻辑

pull/41/head
fengshuonan 2022-11-09 15:16:01 +08:00
parent 88903ab02d
commit 385f5fd783
1 changed files with 6 additions and 3 deletions

View File

@ -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) {