xieb
2024-10-15 6e2a9e4d101b9c9c3b811f2d49332581c6c0f335
skjcmanager/skjcmanager-gateway/src/main/java/cn/gistack/gateway/filter/AuthFilter.java
@@ -37,7 +37,6 @@
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.Base64Utils;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -68,8 +67,6 @@
         return chain.filter(exchange);
      }
      //校验 Token 合法性
      ServerHttpResponse resp = exchange.getResponse();
      String headerToken = exchange.getRequest().getHeaders().getFirst(AuthProvider.AUTH_KEY);
@@ -92,7 +89,7 @@
         String token = new String(decoded);
         int index = token.indexOf(":");
         String [] tokens = new String[]{token.substring(0, index), token.substring(index + 1)};
         String[] tokens = new String[]{token.substring(0, index), token.substring(index + 1)};
         if (tokens.length <= 0) {
            return unAuth(resp, "缺失令牌,鉴权失败");
         }
@@ -124,8 +121,8 @@
   private boolean isSkip(String path) {
      return AuthProvider.getDefaultSkipUrl().stream().anyMatch(pattern -> antPathMatcher.match(pattern, path))
         || authProperties.getSkipUrl().stream().anyMatch(pattern -> antPathMatcher.match(pattern, path))
          || authProperties.getAuth().stream().anyMatch(auth -> antPathMatcher.match(auth.getPattern(), path))
          || authProperties.getBasic().stream().anyMatch(basic -> antPathMatcher.match(basic.getPattern(), path))
         || authProperties.getAuth().stream().anyMatch(auth -> antPathMatcher.match(auth.getPattern(), path))
         || authProperties.getBasic().stream().anyMatch(basic -> antPathMatcher.match(basic.getPattern(), path))
         || authProperties.getSign().stream().anyMatch(sign -> antPathMatcher.match(sign.getPattern(), path));
   }