refactor: 优化后台登出的逻辑

This commit is contained in:
CaptainB 2022-12-03 13:31:28 +08:00
parent 1af9a3d173
commit 41b5a18a8b
1 changed files with 3 additions and 0 deletions

View File

@ -33,6 +33,9 @@ public class SSOLogoutService {
*/ */
public void logout(String sessionId, HttpServletResponse response) throws Exception { public void logout(String sessionId, HttpServletResponse response) throws Exception {
Object obj = redisIndexedSessionRepository.findById(sessionId); Object obj = redisIndexedSessionRepository.findById(sessionId);
if (obj == null) {
return;
}
String authId = (String) MethodUtils.invokeMethod(obj, "getAttribute", "authId"); String authId = (String) MethodUtils.invokeMethod(obj, "getAttribute", "authId");
AuthSource authSource = authSourceMapper.selectByPrimaryKey(authId); AuthSource authSource = authSourceMapper.selectByPrimaryKey(authId);
if (authSource != null) { if (authSource != null) {