|
|
@@ -30,15 +30,15 @@ import javax.servlet.http.Cookie;
|
|
|
public class AccountAuthServiceImpl implements AccountAuthService {
|
|
|
private final String cookieName = "USERDATA";
|
|
|
private final String domain = "";
|
|
|
- private final Cache<String, Object> caffeineCache;
|
|
|
+ private final Cache<String, Object> cache;
|
|
|
private final UserRepository userRepository;
|
|
|
private final CodeService codeService;
|
|
|
private final PubkeyService pubkeyService;
|
|
|
private final PasswordEncoder passwordEncoder;
|
|
|
|
|
|
- public AccountAuthServiceImpl(Cache<String, Object> caffeineCache, UserRepository userRepository,
|
|
|
+ public AccountAuthServiceImpl(Cache<String, Object> cache, UserRepository userRepository,
|
|
|
CodeService codeService, PubkeyService pubkeyService, PasswordEncoder passwordEncoder) {
|
|
|
- this.caffeineCache = caffeineCache;
|
|
|
+ this.cache = cache;
|
|
|
this.userRepository = userRepository;
|
|
|
this.codeService = codeService;
|
|
|
this.pubkeyService = pubkeyService;
|
|
|
@@ -111,7 +111,7 @@ public class AccountAuthServiceImpl implements AccountAuthService {
|
|
|
if (timeout == 0) {
|
|
|
timeout = 3600*24*30;
|
|
|
}
|
|
|
- caffeineCache.put(loginSuccessKey, authToken);
|
|
|
+ cache.put(loginSuccessKey, authToken);
|
|
|
}
|
|
|
|
|
|
private Cookie generateCookie(String name, String value, long timeout) {
|
|
|
@@ -136,14 +136,6 @@ public class AccountAuthServiceImpl implements AccountAuthService {
|
|
|
|
|
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
|
|
if (authentication instanceof AccountAuthToken) {
|
|
|
- AccountAuthToken authToken = (AccountAuthToken) authentication;
|
|
|
- int userId = authToken.getUserId();
|
|
|
- String loginId = authToken.getLoginId();
|
|
|
- clearCookie();
|
|
|
-
|
|
|
- String userdata = String.format("%s:%s:%s", userId, 1, loginId);
|
|
|
- deleteLoginData(userdata);
|
|
|
-
|
|
|
SecurityContext context = SecurityContextHolder.getContext();
|
|
|
context.setAuthentication(null);
|
|
|
SecurityContextHolder.clearContext();
|
|
|
@@ -160,7 +152,4 @@ public class AccountAuthServiceImpl implements AccountAuthService {
|
|
|
cookie2.setPath(path);
|
|
|
ServletUtil.getResponse().addCookie(cookie2);
|
|
|
}
|
|
|
-
|
|
|
- private void deleteLoginData(String userdata) {
|
|
|
- }
|
|
|
}
|