This commit is contained in:
2023-06-13 09:41:20 +08:00
parent 95bae3f9b3
commit 42781d03c8
6 changed files with 29 additions and 19 deletions

View File

@ -1,6 +1,5 @@
package com.qiaoba.auth.filters;
import cn.hutool.core.util.StrUtil;
import com.qiaoba.api.auth.service.AuthConfigApiService;
import com.qiaoba.auth.constants.SecurityConstant;
import com.qiaoba.auth.entity.dto.OnlineUserDto;
@ -48,7 +47,7 @@ public class AuthenticationCoreFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain) throws ServletException, IOException {
log.debug(StrUtil.format("Start run AuthenticationCoreFilter, Uri: {}", request.getRequestURI()));
log.debug("Start run AuthenticationCoreFilter, Uri: {}", request.getRequestURI());
// 白名单 放行
for (String uri : authConfigProperties.getWhitelist()) {
if (UriUtil.match(uri, request.getRequestURI())) {

View File

@ -46,13 +46,15 @@ public class AuthConfigServiceImpl implements AuthConfigApiService {
@Override
public Long getBlacklistExpireTime() {
return redisService.getObject(ConfigConstant.BLACKLIST_EXPIRE_TIME_KEY, Long.class);
Object expireTime = redisService.get(ConfigConstant.BLACKLIST_EXPIRE_TIME_KEY);
return Objects.isNull(expireTime) ? ConfigConstant.DEFAULT_MAX_BLACKLIST_EXPIRE_TIME : Long.parseLong(expireTime.toString());
}
@Override
public Integer getAllowMaxErrorCount() {
Integer count = redisService.getObject(ConfigConstant.LOGIN_ERROR_MAX_COUNT_KEY, Integer.class);
return Objects.isNull(count) ? ConfigConstant.DEFAULT_LOGIN_ERROR_MAX_COUNT : count;
Object count = redisService.get(ConfigConstant.LOGIN_ERROR_MAX_COUNT_KEY);
return Objects.isNull(count) ? ConfigConstant.DEFAULT_LOGIN_ERROR_MAX_COUNT : Integer.parseInt(count.toString());
}
@Override