|
@@ -9,6 +9,8 @@ import com.fdkankan.common.util.JwtUtil;
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
|
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
|
|
import org.springframework.core.Ordered;
|
|
@@ -29,6 +31,7 @@ import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
+@RefreshScope
|
|
|
public class TokenFilter implements GlobalFilter, Ordered {
|
|
|
|
|
|
private static final String TOKEN = "token";
|
|
@@ -37,6 +40,9 @@ public class TokenFilter implements GlobalFilter, Ordered {
|
|
|
|
|
|
private static final List<String> ignoreAuthUrls = new ArrayList<>();
|
|
|
|
|
|
+ @Value("${tokenCheck:check}")
|
|
|
+ private String tokenCheck;
|
|
|
+
|
|
|
// @Resource
|
|
|
// private RedisUtil redisUtil;
|
|
|
@Autowired
|
|
@@ -79,6 +85,9 @@ public class TokenFilter implements GlobalFilter, Ordered {
|
|
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
|
|
ServerHttpRequest request = exchange.getRequest();
|
|
|
ServerHttpResponse response = exchange.getResponse();
|
|
|
+ if(!"check".equals(tokenCheck)){
|
|
|
+ return chain.filter(exchange);
|
|
|
+ }
|
|
|
// 获取当前请求路径
|
|
|
String path = request.getURI().getPath();
|
|
|
log.info("当前路径为" + path + ",判断是否为忽略路径.");
|