Преглед на файлове

Merge branch 'dev' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev

xiaof преди 4 години
родител
ревизия
c26eda7a51
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      distributed-print/src/main/java/com/qmth/distributed/print/interceptor/AuthInterceptor.java

+ 9 - 1
distributed-print/src/main/java/com/qmth/distributed/print/interceptor/AuthInterceptor.java

@@ -4,6 +4,7 @@ import com.qmth.boot.api.interceptor.ExtendInterceptor;
 import com.qmth.distributed.print.business.util.AuthUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.lang.Nullable;
 import org.springframework.stereotype.Component;
 import org.springframework.web.servlet.ModelAndView;
@@ -15,10 +16,17 @@ import javax.servlet.http.HttpServletResponse;
 public class AuthInterceptor extends ExtendInterceptor {
     private final static Logger log = LoggerFactory.getLogger(AuthInterceptor.class);
 
+    @Value("${com.qmth.api.metrics-endpoint}")
+    String endpoint;
+
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         log.info("preHandle is come in");
-        return AuthUtil.adminAuthInterceptor(request, response);
+        if (request.getServletPath().contains(endpoint)) {
+            return true;
+        } else {
+            return AuthUtil.adminAuthInterceptor(request, response);
+        }
     }
 
     @Override