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
fa1c128c
Commit
fa1c128c
authored
Nov 23, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xxx
parent
a81874b8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
7 additions
and
9 deletions
+7
-9
AdminTokenService.java
...in/java/com/egolm/film/api/service/AdminTokenService.java
+1
-0
MemberTokenService.java
...n/java/com/egolm/film/api/service/MemberTokenService.java
+1
-0
TokenService.java
src/main/java/com/egolm/film/api/service/TokenService.java
+0
-2
UserTokenService.java
...ain/java/com/egolm/film/api/service/UserTokenService.java
+1
-0
MemberTokenServiceImpl.java
...m/egolm/film/api/service/impl/MemberTokenServiceImpl.java
+1
-1
AdminLoginInterceptor.java
.../egolm/film/config/interceptor/AdminLoginInterceptor.java
+1
-2
MemberLoginInterceptor.java
...egolm/film/config/interceptor/MemberLoginInterceptor.java
+1
-2
UserLoginInterceptor.java
...m/egolm/film/config/interceptor/UserLoginInterceptor.java
+1
-2
No files found.
src/main/java/com/egolm/film/api/service/AdminTokenService.java
View file @
fa1c128c
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service;
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service;
public
interface
AdminTokenService
extends
TokenService
{
public
interface
AdminTokenService
extends
TokenService
{
final
String
LOGINID_COOKIE_NAME
=
"admin_token"
;
final
String
TOKEN_NAME
=
"FILM_ADMIN_LOGIN_TOKEN_NAME"
;
final
String
TOKEN_NAME
=
"FILM_ADMIN_LOGIN_TOKEN_NAME"
;
final
String
LOG_TYPE
=
"ADMIN"
;
final
String
LOG_TYPE
=
"ADMIN"
;
...
...
src/main/java/com/egolm/film/api/service/MemberTokenService.java
View file @
fa1c128c
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service;
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service;
public
interface
MemberTokenService
extends
TokenService
{
public
interface
MemberTokenService
extends
TokenService
{
final
String
LOGINID_COOKIE_NAME
=
"member_token"
;
final
String
TOKEN_NAME
=
"FILM_MEMBER_LOGIN_TOKEN_NAME"
;
final
String
TOKEN_NAME
=
"FILM_MEMBER_LOGIN_TOKEN_NAME"
;
final
String
LOG_TYPE
=
"MEMBER"
;
final
String
LOG_TYPE
=
"MEMBER"
;
...
...
src/main/java/com/egolm/film/api/service/TokenService.java
View file @
fa1c128c
...
@@ -6,8 +6,6 @@ import com.egolm.film.model.LoginToken;
...
@@ -6,8 +6,6 @@ import com.egolm.film.model.LoginToken;
public
interface
TokenService
{
public
interface
TokenService
{
final
String
LOGINID_COOKIE_NAME
=
"token"
;
LoginToken
getToken
();
LoginToken
getToken
();
LoginToken
doLogin
(
String
username
,
String
password
);
LoginToken
doLogin
(
String
username
,
String
password
);
...
...
src/main/java/com/egolm/film/api/service/UserTokenService.java
View file @
fa1c128c
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service;
...
@@ -2,6 +2,7 @@ package com.egolm.film.api.service;
public
interface
UserTokenService
extends
TokenService
{
public
interface
UserTokenService
extends
TokenService
{
final
String
LOGINID_COOKIE_NAME
=
"user_token"
;
final
String
TOKEN_NAME
=
"FILM_USER_LOGIN_TOKEN_NAME"
;
final
String
TOKEN_NAME
=
"FILM_USER_LOGIN_TOKEN_NAME"
;
final
String
LOG_TYPE
=
"USER"
;
final
String
LOG_TYPE
=
"USER"
;
...
...
src/main/java/com/egolm/film/api/service/impl/MemberTokenServiceImpl.java
View file @
fa1c128c
...
@@ -51,7 +51,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
...
@@ -51,7 +51,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
Integer
id
=
member
.
getId
();
Integer
id
=
member
.
getId
();
LoginToken
token
=
new
LoginToken
(
id
);
LoginToken
token
=
new
LoginToken
(
id
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
session
.
setAttribute
(
TOKEN_NAME
,
token
);
Cookie
cookie
=
WebMvcConfig
.
get
Cookie
(
LOGINID_COOKIE_NAME
);
Cookie
cookie
=
WebMvcConfig
.
get
OrCreateUUIDCookie
(
LOGINID_COOKIE_NAME
,
"/"
,
60
*
60
,
true
);
if
(
cookie
!=
null
)
{
if
(
cookie
!=
null
)
{
memberService
.
updateToken
(
id
,
cookie
.
getValue
());
memberService
.
updateToken
(
id
,
cookie
.
getValue
());
}
}
...
...
src/main/java/com/egolm/film/config/interceptor/AdminLoginInterceptor.java
View file @
fa1c128c
...
@@ -9,7 +9,6 @@ import org.springframework.stereotype.Component;
...
@@ -9,7 +9,6 @@ import org.springframework.stereotype.Component;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.TokenService
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
@Component
@Component
...
@@ -28,7 +27,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -28,7 +27,7 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
Cookie
[]
cookies
=
req
.
getCookies
();
Cookie
[]
cookies
=
req
.
getCookies
();
if
(
cookies
!=
null
)
{
if
(
cookies
!=
null
)
{
for
(
Cookie
cookie
:
cookies
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
TokenService
.
LOGINID_COOKIE_NAME
))
{
if
(
cookie
.
getName
().
equals
(
Admin
TokenService
.
LOGINID_COOKIE_NAME
))
{
sessionid
=
cookie
.
getValue
();
sessionid
=
cookie
.
getValue
();
}
}
}
}
...
...
src/main/java/com/egolm/film/config/interceptor/MemberLoginInterceptor.java
View file @
fa1c128c
...
@@ -9,7 +9,6 @@ import org.springframework.stereotype.Component;
...
@@ -9,7 +9,6 @@ import org.springframework.stereotype.Component;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.film.api.service.MemberTokenService
;
import
com.egolm.film.api.service.MemberTokenService
;
import
com.egolm.film.api.service.TokenService
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
@Component
@Component
...
@@ -27,7 +26,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -27,7 +26,7 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
String
sessionid
=
null
;
String
sessionid
=
null
;
Cookie
[]
cookies
=
req
.
getCookies
();
Cookie
[]
cookies
=
req
.
getCookies
();
for
(
Cookie
cookie
:
cookies
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
TokenService
.
LOGINID_COOKIE_NAME
))
{
if
(
cookie
.
getName
().
equals
(
Member
TokenService
.
LOGINID_COOKIE_NAME
))
{
sessionid
=
cookie
.
getValue
();
sessionid
=
cookie
.
getValue
();
}
}
}
}
...
...
src/main/java/com/egolm/film/config/interceptor/UserLoginInterceptor.java
View file @
fa1c128c
...
@@ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.film.api.service.TokenService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
...
@@ -27,7 +26,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -27,7 +26,7 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
String
sessionid
=
null
;
String
sessionid
=
null
;
Cookie
[]
cookies
=
req
.
getCookies
();
Cookie
[]
cookies
=
req
.
getCookies
();
for
(
Cookie
cookie
:
cookies
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
TokenService
.
LOGINID_COOKIE_NAME
))
{
if
(
cookie
.
getName
().
equals
(
User
TokenService
.
LOGINID_COOKIE_NAME
))
{
sessionid
=
cookie
.
getValue
();
sessionid
=
cookie
.
getValue
();
}
}
}
}
...
...
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