Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gechengyang
nouiWithSpringMVC
Commits
ee7a240c
Commit
ee7a240c
authored
Jul 09, 2020
by
cjh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改后台同时请求token挤掉线问题
parent
edddf672
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
4 deletions
+11
-4
NoUiRequest.java
...va/org/sss/presentation/noui/api/request/NoUiRequest.java
+5
-1
Constants.java
...main/java/org/sss/presentation/noui/common/Constants.java
+2
-0
NoUiContextManager.java
...org/sss/presentation/noui/context/NoUiContextManager.java
+2
-1
TokenInterceptor.java
.../java/org/sss/presentation/noui/jwt/TokenInterceptor.java
+2
-2
No files found.
src/main/java/org/sss/presentation/noui/api/request/NoUiRequest.java
View file @
ee7a240c
...
...
@@ -27,7 +27,11 @@ public class NoUiRequest {
String
tokenId
=
request
.
getHeader
(
"token"
);
String
userId
=
request
.
getHeader
(
"userId"
);
String
terminalType
=
request
.
getHeader
(
"terminalType"
);
this
.
token
=
tokenId
;
if
(
tokenId
.
startsWith
(
Constants
.
BACKGROUND_FLAG
)){
this
.
token
=
tokenId
.
substring
(
Constants
.
BACKGROUND_FLAG
.
length
());
}
else
{
this
.
token
=
tokenId
;
}
this
.
userId
=
userId
;
this
.
terminalType
=
terminalType
;
this
.
mappingUrl
=
mappingUrl
;
...
...
src/main/java/org/sss/presentation/noui/common/Constants.java
View file @
ee7a240c
...
...
@@ -14,4 +14,6 @@ public class Constants {
public
final
static
String
MAPPING_PRE
=
"_"
;
public
final
static
String
SESSION
=
"session"
;
public
final
static
String
BACKGROUND_FLAG
=
"BackGroundRequest-"
;
}
src/main/java/org/sss/presentation/noui/context/NoUiContextManager.java
View file @
ee7a240c
...
...
@@ -48,7 +48,8 @@ public class NoUiContextManager {
Class
<?>
clazz
=
Class
.
forName
(
"org.sss.module."
+
dbType
+
".ModuleSessionImpl"
);
session
=
(
IModuleSession
)
ConstructorUtils
.
invokeConstructor
(
clazz
,
new
Object
[]
{
noUiContext
});
}
catch
(
Exception
e
)
{
throw
new
NoUiException
(
"Constructs NoUiContext error"
);
log
.
error
(
"Constructs NoUiContext error"
,
e
);
throw
new
NoUiException
(
"Constructs NoUiContext error"
,
e
);
}
noUiContext
.
setGui
(
new
NoUiPresentation
(
noUiContext
,
noUiRequest
));
noUiContext
.
setSession
(
session
);
...
...
src/main/java/org/sss/presentation/noui/jwt/TokenInterceptor.java
View file @
ee7a240c
...
...
@@ -60,8 +60,8 @@ public class TokenInterceptor implements HandlerInterceptor {
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
}
//验证token是否一致
if
(!
token
.
equals
(
redisLoginInfo
.
getToken
())){
//验证token是否一致
如果为后台直接调用交易,则直接跳过token验证
if
(
!
token
.
startsWith
(
Constants
.
BACKGROUND_FLAG
)
&&
!
token
.
equals
(
redisLoginInfo
.
getToken
())){
Result
rt
=
new
Result
(
ErrorCodes
.
LOGIN_TOKEN_CHECKERROR
,
"token失效,该用户被强迫下线"
,
null
);
responseMessage
(
response
,
response
.
getWriter
(),
rt
);
return
false
;
...
...
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