Authored by csgyoho

测试

1 package com.yohoufo.common.interceptor; 1 package com.yohoufo.common.interceptor;
2 2
3 -import java.lang.reflect.Method;  
4 -import java.util.*;  
5 -  
6 -import javax.annotation.Resource;  
7 -import javax.crypto.Mac;  
8 -import javax.crypto.spec.SecretKeySpec;  
9 -import javax.servlet.http.HttpServletRequest;  
10 -import javax.servlet.http.HttpServletResponse;  
11 - 3 +import com.google.common.collect.ImmutableList;
  4 +import com.netflix.config.DynamicPropertyFactory;
  5 +import com.yoho.core.common.utils.MD5;
  6 +import com.yoho.core.config.ConfigReader;
12 import com.yoho.error.event.LogEvent; 7 import com.yoho.error.event.LogEvent;
13 import com.yohoufo.common.annotation.IgnoreSignature; 8 import com.yohoufo.common.annotation.IgnoreSignature;
14 import com.yohoufo.common.exception.SignatureNotMatchException; 9 import com.yohoufo.common.exception.SignatureNotMatchException;
@@ -23,10 +18,13 @@ import org.springframework.web.method.HandlerMethod; @@ -23,10 +18,13 @@ import org.springframework.web.method.HandlerMethod;
23 import org.springframework.web.servlet.HandlerInterceptor; 18 import org.springframework.web.servlet.HandlerInterceptor;
24 import org.springframework.web.servlet.ModelAndView; 19 import org.springframework.web.servlet.ModelAndView;
25 20
26 -import com.google.common.collect.ImmutableList;  
27 -import com.netflix.config.DynamicPropertyFactory;  
28 -import com.yoho.core.common.utils.MD5;  
29 -import com.yoho.core.config.ConfigReader; 21 +import javax.annotation.Resource;
  22 +import javax.crypto.Mac;
  23 +import javax.crypto.spec.SecretKeySpec;
  24 +import javax.servlet.http.HttpServletRequest;
  25 +import javax.servlet.http.HttpServletResponse;
  26 +import java.lang.reflect.Method;
  27 +import java.util.*;
30 28
31 public class SignatureVerifyInterceptor implements HandlerInterceptor, ApplicationEventPublisherAware { 29 public class SignatureVerifyInterceptor implements HandlerInterceptor, ApplicationEventPublisherAware {
32 30
@@ -53,6 +51,7 @@ public class SignatureVerifyInterceptor implements HandlerInterceptor, Applicati @@ -53,6 +51,7 @@ public class SignatureVerifyInterceptor implements HandlerInterceptor, Applicati
53 public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { 51 public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
54 //(1) 验签开关, 控制是否需要验签. 默认需要验证 52 //(1) 验签开关, 控制是否需要验签. 默认需要验证
55 boolean isSignatureVerifyEnable = configReader.getBoolean("gateway.security.isSignatureVerifyEnable", true); 53 boolean isSignatureVerifyEnable = configReader.getBoolean("gateway.security.isSignatureVerifyEnable", true);
  54 + logger.info("isDebugEnable is {},request param debug is {}",isDebugEnable,httpServletRequest.getParameter("debug"));//TODO test
56 if(!isSignatureVerifyEnable){ 55 if(!isSignatureVerifyEnable){
57 logger.debug("gateway.security.isSignatureVerifyEnable is false"); 56 logger.debug("gateway.security.isSignatureVerifyEnable is false");
58 return true; 57 return true;