diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java index 868c6e0185..4040a8c66d 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java @@ -1,6 +1,7 @@ package com.epmet.openapi.scan.interceptor; import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; @@ -32,7 +33,9 @@ public class ScanApiAuthInterceptor implements HandlerInterceptor { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String ip = IpUtils.getIpAddr(request); SetOperations setOperations = redisTemplate.opsForSet(); - if (!setOperations.isMember(RedisKeys.getWhiteList(), ip)) { + if (setOperations.isMember(RedisKeys.getWhiteList(), StrConstant.STAR)){ + return true; + }else if (!setOperations.isMember(RedisKeys.getWhiteList(), ip)) { log.error("preHandle ip:{} 不在白名单内", ip); String result = JSON.toJSONString(new Result<>().error(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg())); responseJson(response, result);