package com.kidgrow.zuul.config; import org.springframework.util.AntPathMatcher; import java.util.Arrays; import java.util.List; /** * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020
* * @Description: 忽略token 配置类
* @Project:
* @CreateDate: Created in 2020/2/12 10:42
* @Author: liuke */ public class IgnoreTokenConfig { public static final List 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 list, String currentUri) { if (list.isEmpty()) { return false; } return list.stream().anyMatch((url) -> currentUri.startsWith(url) || ANT_PATH_MATCHER.match(url, currentUri) ); } }