Browse Source

ip黑名单管理

master
zhouyl 1 year ago
parent
commit
fd71c97dc5
  1. 5
      tp-framework/src/main/java/com/inscloudtech/framework/interceptor/IpAccessInterceptor.java

5
tp-framework/src/main/java/com/inscloudtech/framework/interceptor/IpAccessInterceptor.java

@ -24,8 +24,9 @@ public class IpAccessInterceptor implements HandlerInterceptor {
Set<String> cacheSet = RedisUtils.getCacheSet(Constants.BLACK_IP_LIST);
if (cacheSet.contains(ip)) {
// 在黑名单中直接拒绝访问
log.info("ip:{} 在黑名单中拒绝访问.....", ip);
return false;
// log.info("ip:{} 在黑名单中拒绝访问.....", ip);
throw new RuntimeException(ip+"黑名单中拒绝访问");
// return false;
}
// 验证通过

Loading…
Cancel
Save