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