Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
曲欣亮
sentinel
Commits
795e6ac5
Commit
795e6ac5
authored
Dec 19, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
51d4d191
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
AdminTokenServiceImpl.java
...om/egolm/film/api/service/impl/AdminTokenServiceImpl.java
+1
-0
WebMvcConfig.java
src/main/java/com/egolm/film/config/WebMvcConfig.java
+17
-0
No files found.
src/main/java/com/egolm/film/api/service/impl/AdminTokenServiceImpl.java
View file @
795e6ac5
...
@@ -88,6 +88,7 @@ public class AdminTokenServiceImpl implements AdminTokenService {
...
@@ -88,6 +88,7 @@ public class AdminTokenServiceImpl implements AdminTokenService {
HttpSession
session
=
WebMvcConfig
.
getSession
();
HttpSession
session
=
WebMvcConfig
.
getSession
();
session
.
removeAttribute
(
TOKEN_NAME
);
session
.
removeAttribute
(
TOKEN_NAME
);
session
.
invalidate
();
session
.
invalidate
();
WebMvcConfig
.
getOrCreateUUIDCookie
(
LOGINID_COOKIE_NAME
,
"/"
,
60
*
60
*
24
*
5
,
true
);
}
}
@Override
@Override
...
...
src/main/java/com/egolm/film/config/WebMvcConfig.java
View file @
795e6ac5
...
@@ -119,6 +119,23 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
...
@@ -119,6 +119,23 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
return
cookie
;
return
cookie
;
}
}
public
static
void
removeCookie
(
String
name
,
String
path
)
{
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
HttpServletResponse
response
=
WebMvcConfig
.
getResponse
();
if
(
request
!=
null
)
{
Cookie
[]
cookies
=
request
.
getCookies
();
if
(
cookies
!=
null
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
name
))
{
cookie
.
setMaxAge
(
0
);
cookie
.
setValue
(
null
);
response
.
addCookie
(
cookie
);
}
}
}
}
}
public
static
String
getRemoteIp
()
{
public
static
String
getRemoteIp
()
{
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
String
ip
=
request
.
getHeader
(
"X-Real_IP"
);
String
ip
=
request
.
getHeader
(
"X-Real_IP"
);
...
...
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