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
ed77ab6d
Commit
ed77ab6d
authored
Sep 28, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志
parent
f0b21d20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
yd-auth-core/src/main/java/com/yd/auth/core/security/JwtAuthenticationFilter.java
+3
-1
No files found.
yd-auth-core/src/main/java/com/yd/auth/core/security/JwtAuthenticationFilter.java
View file @
ed77ab6d
...
...
@@ -57,7 +57,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
log
.
info
(
"从HTTP请求中解析JWT令牌(通常从Authorization头获取):{}"
,
token
);
// 2. 检查令牌是否存在且有效
if
(
token
!=
null
&&
tokenProvider
.
validateToken
(
token
))
{
if
(
token
!=
null
)
{
if
(
tokenProvider
.
validateToken
(
token
)){
// 3. 从JWT令牌中提取用户唯一标识(业务ID)
String
userBizId
=
tokenProvider
.
getUserBizIdFromToken
(
token
);
...
...
@@ -78,6 +79,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
// 6. 将认证对象设置到SecurityContext中,表示用户已认证,这里设置后续接口能直接拿到登录用户信息
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
}
}
// 7. 继续执行后续过滤器链(无论是否认证都要继续处理请求)
filterChain
.
doFilter
(
request
,
response
);
...
...
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