Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-cloud-core
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-cloud-core
Commits
03fd1058
Commit
03fd1058
authored
Mar 09, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
5af1ef9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
7 deletions
+38
-7
yd-gateway/src/main/java/com/yd/gateway/config/GatewayJwtAuthFilterConfig.java
+38
-7
No files found.
yd-gateway/src/main/java/com/yd/gateway/config/GatewayJwtAuthFilterConfig.java
View file @
03fd1058
...
@@ -93,16 +93,47 @@ public class GatewayJwtAuthFilterConfig {
...
@@ -93,16 +93,47 @@ public class GatewayJwtAuthFilterConfig {
return
false
;
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
)
{
//
private boolean isWhitelist(String path) {
// 白名单路径:与SecurityWebFilterChain中的配置保持一致
//
// 白名单路径:与SecurityWebFilterChain中的配置保持一致
return
path
.
startsWith
(
"/auth/"
)
//
return path.startsWith("/auth/")
||
path
.
startsWith
(
"/swagger-ui/"
)
//
|| path.startsWith("/swagger-ui/")
||
path
.
startsWith
(
"/v3/api-docs/"
)
//
|| path.startsWith("/v3/api-docs/")
||
isKnife4jWhitelist
(
path
);
//
|| isKnife4jWhitelist(path);
}
//
}
/**
/**
* 设置401响应
* 设置401响应
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment