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:
@@ -7,5 +7,5 @@ import java.util.HashMap;
|
||||
public interface ILoginService {
|
||||
HashMap<String, String> login(User user);
|
||||
|
||||
void logout();
|
||||
boolean logout();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user