Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-gateway
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ab15693b
authored
Apr 20, 2023
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化代码
1 parent
9d27b0a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
src/main/java/cn/com/glsx/gateway/filter/OpenApiAuthCheckFilter.java
src/main/java/cn/com/glsx/gateway/filter/OpenApiAuthCheckFilter.java
View file @
ab15693
...
...
@@ -66,7 +66,7 @@ public class OpenApiAuthCheckFilter implements GlobalFilter, Ordered {
}
//跳过不符合需要验证的路径
if
(
StringUtils
.
isMatchedStr
(
openApiUrls
,
url
))
{
if
(
!
StringUtils
.
isMatchedStr
(
openApiUrls
,
url
))
{
return
chain
.
filter
(
exchange
);
}
...
...
@@ -95,8 +95,15 @@ public class OpenApiAuthCheckFilter implements GlobalFilter, Ordered {
}
};
DecodedJWT
decodedJWT
=
null
;
//解码Token
DecodedJWT
decodedJWT
=
gatewayJwtUtils
.
decode
(
accessToken
);
try
{
decodedJWT
=
gatewayJwtUtils
.
decode
(
accessToken
);
}
catch
(
Exception
e
)
{
log
.
error
(
"解码Token失败,{}"
,
e
.
toString
());
// TODO: 2023/4/20 待优化下面返回封装统一方法
return
exchange
.
getResponse
().
writeWith
(
Mono
.
just
(
exchange
.
getResponse
().
bufferFactory
().
wrap
(
JSON
.
toJSONString
(
OpenApiResult
.
failure
(
"40003"
,
"AccessToken Error."
)).
getBytes
())));
}
String
serName
=
decodedJWT
.
getClaim
(
"name"
).
asString
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment