1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Added unauthorized access response. Added logout.

This commit is contained in:
2023-05-05 02:31:35 +08:00
parent ac39f886b6
commit 3c8adffe42
7 changed files with 78 additions and 6 deletions

View File

@@ -7,5 +7,5 @@ import java.util.HashMap;
public interface ILoginService {
HashMap<String, String> login(User user);
void logout();
boolean logout();
}

View File

@@ -51,11 +51,11 @@ public class LoginServiceImpl implements ILoginService {
}
@Override
public void logout() {
public boolean logout() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
Long userId = loginUser.getUser().getId();
redisCache.deleteObject("login:" + userId);
return redisCache.deleteObject("login:" + userId);
}
}