Merge pull request 'fix : 黑名单拦截' (#2) from clay into master

Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/2
This commit is contained in:
clay
2024-03-07 07:13:18 +00:00

View File

@@ -43,7 +43,8 @@ public class RequestGlobalFilter implements GlobalFilter, Ordered {
String remoteAddress = IpUtils.getIP(request);
log.info("Method:{{}} Host:{{}} 远程ip:{{}} Path:{{}} Query:{{}}", request.getMethod().name(), request.getURI().getHost(), remoteAddress, request.getURI().getPath(), request.getQueryParams());
Boolean flag = redisTemplate.opsForSet().isMember(IpBackUtils.BLACK_LIST_IP, remoteAddress);
log.info("flag: {}", flag);
log.info("flag: {} (flag != null) :{} (flag != null && flag) :{}", flag, (flag != null), (flag != null && flag))
;
if (flag != null && flag) {
return errorInfo(exchange, Result.error(HttpStatus.FORBIDDEN, "ip为黑名单,无权访问"));
}