Commit 7c50c135 by zhoujinghao

jwt修改

1 parent a961ffd9
...@@ -27,16 +27,12 @@ ...@@ -27,16 +27,12 @@
<dependency> <dependency>
<groupId>org.nafmii</groupId> <groupId>org.nafmii</groupId>
<artifactId>nafmii-common</artifactId> <artifactId>nafmii-common</artifactId>
</dependency> <exclusions><!-- 去掉springboot默认配置 -->
<dependency> <exclusion>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<!--<exclusions>&lt;!&ndash; 去掉springboot默认配置 &ndash;&gt;--> </exclusion>
<!--<exclusion>--> </exclusions>
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-logging</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -33,19 +33,17 @@ public class AccessFilter implements GlobalFilter, Ordered { ...@@ -33,19 +33,17 @@ public class AccessFilter implements GlobalFilter, Ordered {
@Autowired @Autowired
private AntPathMatcher antPathMatcher; //路径匹配器 private AntPathMatcher antPathMatcher; //路径匹配器
@Override @Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
String url = exchange.getRequest().getURI().getPath(); String url = exchange.getRequest().getURI().getPath();
List<String> skipAuthUrls =new ArrayList<>();
//相关不需要的接口地址 //相关不需要的接口地址
skipAuthUrls.add("111111"); String skip ="app/nafmii/**";
//跳过不需要验证的url //跳过不需要验证的url
for (String skip : skipAuthUrls) { if (antPathMatcher.match(skip, url)){
if (antPathMatcher.match(skip, url)){
return chain.filter(exchange); return chain.filter(exchange);
} }
}
//获取token //获取token
String token = exchange.getRequest().getHeaders().getFirst(JwtUtils.TOKEN_HEADER); String token = exchange.getRequest().getHeaders().getFirst(JwtUtils.TOKEN_HEADER);
if (StringUtils.isBlank(token)){ if (StringUtils.isBlank(token)){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!