Commit 03fd1058 by zhangxingmin

push

parent 5af1ef9b
......@@ -93,16 +93,47 @@ public class GatewayJwtAuthFilterConfig {
return false;
}
private boolean isWhitelist(String path) {
// 定义所有白名单路径模式(Ant风格)
String[] whitelistPatterns = {
"/auth/**",
"/swagger-ui/**",
"/v3/api-docs/**",
"/doc.html",
"/webjars/**",
"/v3/api-docs/*",
"/swagger-resources/*",
"/swagger-ui/*",
"/auth/v2/api-docs/*",
"/favicon.ico",
"/user/api/v3/api-docs/**",
"/insurance/base/api/v3/api-docs/**",
"/csf/api/v3/api-docs/**",
"/auth/v3/api-docs/**",
// 关键:匹配任意层级下的 ossFile/list
"/**/ossFile/list"
// 如果路径固定,也可以直接加完整路径
// "/api/oss/api/ossFile/list"
};
for (String pattern : whitelistPatterns) {
if (matcher.match(pattern, path)) {
return true;
}
}
return false;
}
/**
* 判断路径是否在白名单中(无需认证)
*/
private boolean isWhitelist(String path) {
// 白名单路径:与SecurityWebFilterChain中的配置保持一致
return path.startsWith("/auth/")
|| path.startsWith("/swagger-ui/")
|| path.startsWith("/v3/api-docs/")
|| isKnife4jWhitelist(path);
}
// private boolean isWhitelist(String path) {
// // 白名单路径:与SecurityWebFilterChain中的配置保持一致
// return path.startsWith("/auth/")
// || path.startsWith("/swagger-ui/")
// || path.startsWith("/v3/api-docs/")
// || isKnife4jWhitelist(path);
// }
/**
* 设置401响应
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment