🐛 Fixing a bug. fix #4773 登陆成功清除累计失败次数异常
This commit is contained in:
1 parent
ca4da3ea8b
commit
b27fd2ae18
2 files changed
+8
-8
No files matched your search
+1
-1
@@ -132,7 +132,7 @@ public class PigxAuthenticationFailureEventHandler implements AuthenticationFail
|
||||
* @param username username
|
||||
*/
|
||||
private void recordLoginFailureTimes(String username) {
|
||||
String key = String.format("%s:%s:%s", CacheConstants.LOGIN_ERROR_TIMES, tenantKeyStrResolver.key(), username);
|
||||
String key = String.format("%s:%s:%s", tenantKeyStrResolver.key(), CacheConstants.LOGIN_ERROR_TIMES, username);
|
||||
Long deltaTimes = ParamResolver.getLong("LOGIN_ERROR_TIMES", 5L);
|
||||
Long times = redisTemplate.opsForValue().increment(key);
|
||||
|
||||
|
||||
+7
-7
@@ -80,9 +80,6 @@ public class PigxAuthenticationSuccessEventHandler implements AuthenticationSucc
|
||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication authentication) {
|
||||
|
||||
// 清除账号历史锁定次数
|
||||
clearLoginFailureTimes(authentication);
|
||||
|
||||
// 写入登录成功的日志
|
||||
OAuth2AccessTokenAuthenticationToken accessTokenAuthentication = (OAuth2AccessTokenAuthenticationToken) authentication;
|
||||
Map<String, Object> map = accessTokenAuthentication.getAdditionalParameters();
|
||||
@@ -90,6 +87,9 @@ public class PigxAuthenticationSuccessEventHandler implements AuthenticationSucc
|
||||
sendSuccessEventLog(request, accessTokenAuthentication, map);
|
||||
}
|
||||
|
||||
// 清除账号历史锁定次数
|
||||
clearLoginFailureTimes(map);
|
||||
|
||||
// 输出token
|
||||
sendAccessTokenResponse(response, authentication);
|
||||
}
|
||||
@@ -127,11 +127,11 @@ public class PigxAuthenticationSuccessEventHandler implements AuthenticationSucc
|
||||
|
||||
/**
|
||||
* 清空登录失败的记录
|
||||
* @param authentication
|
||||
* @param map
|
||||
*/
|
||||
private void clearLoginFailureTimes(Authentication authentication) {
|
||||
String username = authentication.getName();
|
||||
String key = String.format("%s:%s:%s", CacheConstants.LOGIN_ERROR_TIMES, tenantKeyStrResolver.key(), username);
|
||||
private void clearLoginFailureTimes(Map<String, Object> map) {
|
||||
String key = String.format("%s:%s:%s", tenantKeyStrResolver.key(), CacheConstants.LOGIN_ERROR_TIMES,
|
||||
MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME));
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user