Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cfld-postcard-service
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cfld-backend
cfld-postcard-service
Commits
dff0ff9b
Commit
dff0ff9b
authored
Dec 21, 2023
by
zhouxudong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token过期处理
parent
74a1545a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
10 deletions
+2
-10
CurrentUserInterceptor.java
.../postcard/service/config/auth/CurrentUserInterceptor.java
+1
-7
JwtTokenUtil.java
...main/java/com/postcard/service/util/jwt/JwtTokenUtil.java
+1
-3
No files found.
src/main/java/com/postcard/service/config/auth/CurrentUserInterceptor.java
View file @
dff0ff9b
...
...
@@ -24,13 +24,7 @@ public class CurrentUserInterceptor implements AsyncHandlerInterceptor {
throw
new
AuthException
(
"未授权,请重新登录"
);
}
String
token
=
authToken
.
substring
(
"Bearer"
.
length
()
+
1
).
trim
();
JwtInfo
jwtUser
;
try
{
jwtUser
=
JwtTokenUtil
.
getJwtUser
(
token
);
}
catch
(
Exception
e
){
throw
new
AuthException
(
"未授权,请重新登录"
);
}
JwtInfo
jwtUser
=
JwtTokenUtil
.
getJwtUser
(
token
);
// 根据token信息,生成当前登录用户信息的设置,存放容器threadlocal
BaseContextHandler
.
setCurrentUserInfo
(
jwtUser
);
...
...
src/main/java/com/postcard/service/util/jwt/JwtTokenUtil.java
View file @
dff0ff9b
...
...
@@ -101,9 +101,7 @@ public class JwtTokenUtil {
Long
nowTime
=
System
.
currentTimeMillis
();
log
.
debug
(
"nowTime : "
+
nowTime
);
if
(
nowTime
>
expireTime
)
{
resultMap
.
clear
();
flag
=
false
;
resultMap
.
put
(
TokenConstants
.
RESULT
,
TokenConstants
.
TOKEN_RESULT
.
TOKEN_EXPIRED
);
throw
new
AuthException
(
"token过期"
);
}
}
...
...
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