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
42525f86
Commit
42525f86
authored
Sep 29, 2020
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持设置token进入session
parent
b7129f90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+3
-0
ResourceAccessFilter.java
...rg/sss/presentation/noui/filter/ResourceAccessFilter.java
+6
-0
No files found.
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
42525f86
...
...
@@ -92,6 +92,8 @@ public class LoginController {
RedisLoginInfo
redisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
sysmodBytes
,
noUiRequest
.
getTerminalType
());
redisLoginInfo
.
setUserInr
((
String
)
inridf
.
getValue
());
//设置当前用户主键
request
.
getSession
().
setAttribute
(
"token"
,
token
);
NoUiUtils
.
logout
(
userId
,
"*"
);
//清理可能存在的历史缓存
RedisUtil
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisLoginInfo
);
...
...
@@ -154,6 +156,7 @@ public class LoginController {
public
Object
logout
(
HttpServletRequest
request
,
HttpSession
session
)
{
try
{
request
.
getSession
().
removeAttribute
(
"toekn"
);
NoUiRequest
noUiRequest
=
new
NoUiRequest
(
request
,
""
,
null
);
NoUiUtils
.
logout
(
noUiRequest
.
getUserId
(),
"*"
);
//清理可能存在的历史缓存
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
"退出成功"
,
null
);
...
...
src/main/java/org/sss/presentation/noui/filter/ResourceAccessFilter.java
View file @
42525f86
...
...
@@ -31,6 +31,12 @@ public class ResourceAccessFilter implements Filter {
try
{
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
HttpServletResponse
response
=
(
HttpServletResponse
)
res
;
if
(
request
.
getSession
().
getAttribute
(
"token"
)==
null
)
{
response
.
setStatus
(
403
);
forbidden
(
request
,
response
);
return
;
}
String
uri
=
request
.
getRequestURI
();
String
pdfres
;
if
((
pdfres
=
needPdfsFilter
(
uri
))!=
null
)
{
...
...
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