1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| package com.kidgrow.zuul.config;
|
| import org.springframework.util.AntPathMatcher;
|
| import java.util.Arrays;
| import java.util.List;
|
| /**
| * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
| *
| * @Description: 忽略token 配置类<br>
| * @Project: <br>
| * @CreateDate: Created in 2020/2/12 10:42 <br>
| * @Author: <a href="4345453@kidgrow.com">liuke</a>
| */
| public class IgnoreTokenConfig {
| public static final List<String> LIST = Arrays.asList(
| "/error",
| "/actuator/**",
| "/gate/**",
| "/static/**",
| "/anno/**",
| "/**/anno/**",
| "/**/swagger-ui.html",
| "/**/doc.html",
| "/**/webjars/**",
| "/**/v2/api-docs/**",
| "/**/v2/api-docs-ext/**",
| "/**/swagger-resources/**"
| );
| private static final AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
|
| public static boolean isIgnoreToken(String currentUri) {
| return isIgnore(LIST, currentUri);
| }
|
| public static boolean isIgnore(List<String> list, String currentUri) {
| if (list.isEmpty()) {
| return false;
| }
| return list.stream().anyMatch((url) ->
| currentUri.startsWith(url) || ANT_PATH_MATCHER.match(url, currentUri)
| );
| }
| }
|
|