Commit 65b7ba06 authored by 技术部-任文超's avatar 技术部-任文超

消除白名单开关(白名单策略不应依赖开关,此处已为开发、测试模式补齐了所有私有网段{192.168.3.0/24, 192.168.4.0/24,...

消除白名单开关(白名单策略不应依赖开关,此处已为开发、测试模式补齐了所有私有网段{192.168.3.0/24, 192.168.4.0/24, 172.16.0.0/16, 172.16.20.0/16, 172.16.30.0/16,10.0.0.0/8,127.0.0.1 })
parent 0e2b3aa1
......@@ -8,13 +8,11 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
* IP白名单检验
......@@ -27,18 +25,12 @@ import java.util.Objects;
public class IpValidateAdvisor {
private static final Logger LOGGER = LoggerFactory.getLogger(IpValidateAdvisor.class);
@Value("${configserver.disable}")
private Integer isDebug;
@Pointcut("execution(public * cn.quantgroup.xyqb.controller.external.user.InnerController.*(..)) || @annotation(cn.quantgroup.xyqb.aspect.accessable.IpValidator)")
private void whiteIpMatch() {
}
@Around("whiteIpMatch()")
private Object doWhiteIpMatch(ProceedingJoinPoint pjp) throws Throwable {
if(Objects.equals(isDebug, 0)){
return pjp.proceed();
}
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
// 客户端IP
String clientIp = IPUtil.getRemoteIP(request);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment