🌟 增加 放行白名单通配符匹配过滤

This commit is contained in:
JuJu
2020-09-12 09:48:18 +08:00
parent 857a5b26e7
commit d62510f9b5
2 changed files with 83 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ package com.ruoyi.gateway.filter;
import java.util.Arrays;
import javax.annotation.Resource;
import com.ruoyi.common.core.utils.AuthUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
@@ -44,8 +46,7 @@ public class AuthFilter implements GlobalFilter, Ordered
{
String url = exchange.getRequest().getURI().getPath();
// 跳过不需要验证的路径
if (Arrays.asList(whiteList).contains(url))
{
if(AuthUtils.checkWhiteList(Arrays.asList(whiteList),url)){
return chain.filter(exchange);
}
String token = getToken(exchange.getRequest());