mirror of
https://gitee.com/gz-yami/mall4j.git
synced 2026-03-22 09:17:16 +08:00
登录不使用缓存,该缓存命中率不高,同时解决由于由于缓存引起密码无法更改的问题
This commit is contained in:
@@ -63,10 +63,6 @@ public class SysLoginController {
|
||||
*/
|
||||
@PostMapping(value = "/sys/logout")
|
||||
public ResponseEntity<String> logout() {
|
||||
Cache cache = cacheManager.getCache("yami_sys_user");
|
||||
if (cache != null) {
|
||||
cache.evict(SecurityUtils.getSysUser().getUsername());
|
||||
}
|
||||
SecurityContextHolder.clearContext();
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@@ -87,17 +87,17 @@ public class YamiTokenServices implements AuthorizationServerTokenServices, Reso
|
||||
OAuth2AccessToken existingAccessToken = tokenStore.getAccessToken(authentication);
|
||||
OAuth2RefreshToken refreshToken = null;
|
||||
// 如果有token,直接删除,更新token,避免出现缓存问题
|
||||
if (existingAccessToken != null) {
|
||||
if (existingAccessToken.getRefreshToken() != null) {
|
||||
refreshToken = existingAccessToken.getRefreshToken();
|
||||
// The token store could remove the refresh token when the
|
||||
// access token is removed, but we want to
|
||||
// be sure...
|
||||
tokenStore.removeRefreshToken(refreshToken);
|
||||
}
|
||||
tokenStore.removeAccessToken(existingAccessToken);
|
||||
|
||||
}
|
||||
// if (existingAccessToken != null) {
|
||||
// if (existingAccessToken.getRefreshToken() != null) {
|
||||
// refreshToken = existingAccessToken.getRefreshToken();
|
||||
// // The token store could remove the refresh token when the
|
||||
// // access token is removed, but we want to
|
||||
// // be sure...
|
||||
// tokenStore.removeRefreshToken(refreshToken);
|
||||
// }
|
||||
// tokenStore.removeAccessToken(existingAccessToken);
|
||||
//
|
||||
// }
|
||||
|
||||
// Only create a new refresh token if there wasn't an existing one
|
||||
// associated with an expired access token.
|
||||
|
||||
Reference in New Issue
Block a user