Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
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
framework
cloud-backend
Commits
bac0cb27
Commit
bac0cb27
authored
Sep 06, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
f4e18205
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
sys-server/src/main/java/com/zq/system/config/security/TokenFilter.java
+3
-3
user-server/src/main/java/com/zq/user/config/TokenFilter.java
+3
-3
No files found.
sys-server/src/main/java/com/zq/system/config/security/TokenFilter.java
View file @
bac0cb27
...
...
@@ -21,11 +21,11 @@ import com.zq.common.vo.OnlineUserDto;
import
com.zq.system.modules.system.service.OnlineUserService
;
import
com.zq.system.modules.system.service.UserCacheClean
;
import
io.jsonwebtoken.ExpiredJwtException
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.filter.GenericFilterBean
;
import
javax.servlet.FilterChain
;
...
...
@@ -80,7 +80,7 @@ public class TokenFilter extends GenericFilterBean {
userCacheClean
.
cleanUserCache
(
String
.
valueOf
(
tokenProvider
.
getClaims
(
token
).
get
(
TokenProvider
.
AUTHORITIES_KEY
)));
}
}
if
(
onlineUserDto
!=
null
&&
StringUtils
.
hasText
(
token
))
{
if
(
onlineUserDto
!=
null
&&
StringUtils
.
isNotBlank
(
token
))
{
Authentication
authentication
=
tokenProvider
.
getAuthentication
(
token
);
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
// Token 续期
...
...
@@ -98,7 +98,7 @@ public class TokenFilter extends GenericFilterBean {
*/
private
String
resolveToken
(
HttpServletRequest
request
)
{
String
bearerToken
=
request
.
getHeader
(
properties
.
getHeader
());
if
(
StringUtils
.
hasText
(
bearerToken
))
{
if
(
StringUtils
.
isBlank
(
bearerToken
))
{
return
null
;
}
if
(
bearerToken
.
startsWith
(
properties
.
getTokenStartWith
()))
{
...
...
user-server/src/main/java/com/zq/user/config/TokenFilter.java
View file @
bac0cb27
...
...
@@ -21,11 +21,11 @@ import com.zq.common.config.security.SecurityProperties;
import
com.zq.common.context.ContextUtils
;
import
com.zq.common.vo.OnlineUserDto
;
import
io.jsonwebtoken.ExpiredJwtException
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.filter.GenericFilterBean
;
import
javax.servlet.FilterChain
;
...
...
@@ -77,7 +77,7 @@ public class TokenFilter extends GenericFilterBean {
// userCacheClean.cleanUserCache(String.valueOf(tokenProvider.getClaims(token).get(TokenProvider.AUTHORITIES_KEY)));
}
}
if
(
onlineUserDto
!=
null
&&
StringUtils
.
hasText
(
token
))
{
if
(
onlineUserDto
!=
null
&&
StringUtils
.
isNotBlank
(
token
))
{
Authentication
authentication
=
tokenProvider
.
getAuthentication
(
token
);
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
// Token 续期
...
...
@@ -98,7 +98,7 @@ public class TokenFilter extends GenericFilterBean {
*/
private
String
resolveToken
(
HttpServletRequest
request
)
{
String
bearerToken
=
request
.
getHeader
(
properties
.
getHeader
());
if
(
StringUtils
.
hasText
(
bearerToken
))
{
if
(
StringUtils
.
isBlank
(
bearerToken
))
{
return
null
;
}
if
(
bearerToken
.
startsWith
(
properties
.
getTokenStartWith
()))
{
...
...
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