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
67108a46
Commit
67108a46
authored
Mar 18, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
183f9bd4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
0 additions
and
66 deletions
+0
-66
TokenService.java
src/main/java/com/egolm/film/api/service/TokenService.java
+0
-4
AdminTokenServiceImpl.java
...om/egolm/film/api/service/impl/AdminTokenServiceImpl.java
+0
-18
MemberTokenServiceImpl.java
...m/egolm/film/api/service/impl/MemberTokenServiceImpl.java
+0
-18
UserTokenServiceImpl.java
...com/egolm/film/api/service/impl/UserTokenServiceImpl.java
+0
-18
AdminLoginController.java
...va/com/egolm/film/api/web/admin/AdminLoginController.java
+0
-1
MemberLoginController.java
.../com/egolm/film/api/web/member/MemberLoginController.java
+0
-1
AdminLoginInterceptor.java
.../egolm/film/config/interceptor/AdminLoginInterceptor.java
+0
-2
MemberLoginInterceptor.java
...egolm/film/config/interceptor/MemberLoginInterceptor.java
+0
-2
UserLoginInterceptor.java
...m/egolm/film/config/interceptor/UserLoginInterceptor.java
+0
-2
No files found.
src/main/java/com/egolm/film/api/service/TokenService.java
View file @
67108a46
...
@@ -2,8 +2,6 @@ package com.egolm.film.api.service;
...
@@ -2,8 +2,6 @@ package com.egolm.film.api.service;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -25,6 +23,4 @@ public interface TokenService {
...
@@ -25,6 +23,4 @@ public interface TokenService {
boolean
isLoginByToken
(
String
token
);
boolean
isLoginByToken
(
String
token
);
void
doLog
(
HttpServletRequest
request
);
}
}
src/main/java/com/egolm/film/api/service/impl/AdminTokenServiceImpl.java
View file @
67108a46
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.film.api.service.AdminTokenService
;
import
com.egolm.film.api.service.AdminTokenService
;
...
@@ -112,19 +109,4 @@ public class AdminTokenServiceImpl implements AdminTokenService {
...
@@ -112,19 +109,4 @@ public class AdminTokenServiceImpl implements AdminTokenService {
}
}
}
}
@Override
public
void
doLog
(
HttpServletRequest
request
)
{
LoginToken
token
=
this
.
getToken
();
String
loginid
=
String
.
valueOf
(
token
.
getId
());
Date
now
=
new
Date
();
String
path
=
request
.
getRequestURI
().
replace
(
request
.
getContextPath
(),
""
);
String
prefix
=
path
.
split
(
"/"
)[
1
];
String
content
=
JSON
.
toJSONString
(
request
.
getParameterMap
());
String
ip
=
ServletUtil
.
remoteIp
(
request
);
String
user_agent
=
request
.
getHeader
(
"User-Agent"
);
String
sql
=
"insert into fc_logs (type, loginid, prefix, path, ip, content, user_agent, create_time) values (?, ?, ?, ?, ?, ?, ?, ?)"
;
Object
[]
objs
=
new
Object
[]{
LOG_TYPE
,
loginid
,
prefix
,
path
,
ip
,
content
,
user_agent
,
now
};
jdbcTemplate
.
executeUpdate
(
sql
,
objs
);
}
}
}
src/main/java/com/egolm/film/api/service/impl/MemberTokenServiceImpl.java
View file @
67108a46
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.film.api.service.MemberService
;
import
com.egolm.film.api.service.MemberService
;
...
@@ -115,20 +112,5 @@ public class MemberTokenServiceImpl implements MemberTokenService {
...
@@ -115,20 +112,5 @@ public class MemberTokenServiceImpl implements MemberTokenService {
return
false
;
return
false
;
}
}
}
}
@Override
public
void
doLog
(
HttpServletRequest
request
)
{
LoginToken
token
=
this
.
getToken
();
String
loginid
=
String
.
valueOf
(
token
.
getId
());
Date
now
=
new
Date
();
String
path
=
request
.
getRequestURI
().
replace
(
request
.
getContextPath
(),
""
);
String
prefix
=
path
.
split
(
"/"
)[
1
];
String
content
=
JSON
.
toJSONString
(
request
.
getParameterMap
());
String
ip
=
ServletUtil
.
remoteIp
(
request
);
String
user_agent
=
request
.
getHeader
(
"User-Agent"
);
String
sql
=
"insert into fc_logs (type, loginid, prefix, path, ip, content, user_agent, create_time) values (?, ?, ?, ?, ?, ?, ?, ?)"
;
Object
[]
objs
=
new
Object
[]{
LOG_TYPE
,
loginid
,
prefix
,
path
,
ip
,
content
,
user_agent
,
now
};
jdbcTemplate
.
executeUpdate
(
sql
,
objs
);
}
}
}
src/main/java/com/egolm/film/api/service/impl/UserTokenServiceImpl.java
View file @
67108a46
...
@@ -4,13 +4,11 @@ import java.util.Date;
...
@@ -4,13 +4,11 @@ import java.util.Date;
import
java.util.Map
;
import
java.util.Map
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.api.service.Messages
;
...
@@ -108,20 +106,4 @@ public class UserTokenServiceImpl implements UserTokenService {
...
@@ -108,20 +106,4 @@ public class UserTokenServiceImpl implements UserTokenService {
}
}
}
}
@Override
public
void
doLog
(
HttpServletRequest
request
)
{
LoginToken
token
=
this
.
getToken
();
String
loginid
=
String
.
valueOf
(
token
.
getId
());
Date
now
=
new
Date
();
String
path
=
request
.
getRequestURI
().
replace
(
request
.
getContextPath
(),
""
);
String
prefix
=
path
.
split
(
"/"
)[
1
];
String
content
=
JSON
.
toJSONString
(
request
.
getParameterMap
());
String
ip
=
ServletUtil
.
remoteIp
(
request
);
String
user_agent
=
request
.
getHeader
(
"User-Agent"
);
String
sql
=
"insert into fc_logs (type, loginid, prefix, path, ip, content, user_agent, create_time) values (?, ?, ?, ?, ?, ?, ?, ?)"
;
Object
[]
objs
=
new
Object
[]{
LOG_TYPE
,
loginid
,
prefix
,
path
,
ip
,
content
,
user_agent
,
now
};
jdbcTemplate
.
executeUpdate
(
sql
,
objs
);
}
}
}
src/main/java/com/egolm/film/api/web/admin/AdminLoginController.java
View file @
67108a46
...
@@ -34,7 +34,6 @@ public class AdminLoginController {
...
@@ -34,7 +34,6 @@ public class AdminLoginController {
}
else
{
}
else
{
LoginToken
token
=
tokenService
.
doLogin
(
username
,
password
);
LoginToken
token
=
tokenService
.
doLogin
(
username
,
password
);
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
tokenService
.
doLog
(
request
);
return
Rjx
.
jsonOk
().
setData
(
token
);
return
Rjx
.
jsonOk
().
setData
(
token
);
}
else
{
}
else
{
throw
new
XRException
(
"用户名或密码错误"
);
throw
new
XRException
(
"用户名或密码错误"
);
...
...
src/main/java/com/egolm/film/api/web/member/MemberLoginController.java
View file @
67108a46
...
@@ -43,7 +43,6 @@ public class MemberLoginController {
...
@@ -43,7 +43,6 @@ public class MemberLoginController {
}
else
{
}
else
{
LoginToken
token
=
tokenService
.
doLogin
(
username
,
password
);
LoginToken
token
=
tokenService
.
doLogin
(
username
,
password
);
if
(
token
!=
null
)
{
if
(
token
!=
null
)
{
tokenService
.
doLog
(
request
);
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
();
}
else
{
}
else
{
throw
new
XRException
(
messages
.
get
(
"err.user_or_pwd"
));
throw
new
XRException
(
messages
.
get
(
"err.user_or_pwd"
));
...
...
src/main/java/com/egolm/film/config/interceptor/AdminLoginInterceptor.java
View file @
67108a46
...
@@ -20,7 +20,6 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -20,7 +20,6 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
@Override
@Override
public
boolean
preHandle
(
HttpServletRequest
req
,
HttpServletResponse
resp
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
req
,
HttpServletResponse
resp
,
Object
handler
)
throws
Exception
{
if
(
tokenService
.
isLogin
())
{
if
(
tokenService
.
isLogin
())
{
tokenService
.
doLog
(
req
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
else
{
}
else
{
String
sessionid
=
null
;
String
sessionid
=
null
;
...
@@ -33,7 +32,6 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -33,7 +32,6 @@ public class AdminLoginInterceptor extends HandlerInterceptorAdapter {
}
}
}
}
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
tokenService
.
doLog
(
req
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
}
throw
new
XRException
(
"用户未登陆"
,
300
);
throw
new
XRException
(
"用户未登陆"
,
300
);
...
...
src/main/java/com/egolm/film/config/interceptor/MemberLoginInterceptor.java
View file @
67108a46
...
@@ -20,7 +20,6 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -20,7 +20,6 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
@Override
@Override
public
boolean
preHandle
(
HttpServletRequest
req
,
HttpServletResponse
resp
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
req
,
HttpServletResponse
resp
,
Object
handler
)
throws
Exception
{
if
(
tokenService
.
isLogin
())
{
if
(
tokenService
.
isLogin
())
{
tokenService
.
doLog
(
req
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
else
{
}
else
{
String
sessionid
=
null
;
String
sessionid
=
null
;
...
@@ -33,7 +32,6 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -33,7 +32,6 @@ public class MemberLoginInterceptor extends HandlerInterceptorAdapter {
}
}
}
}
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
tokenService
.
doLog
(
req
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
}
throw
new
XRException
(
"用户未登陆"
,
300
);
throw
new
XRException
(
"用户未登陆"
,
300
);
...
...
src/main/java/com/egolm/film/config/interceptor/UserLoginInterceptor.java
View file @
67108a46
...
@@ -20,7 +20,6 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -20,7 +20,6 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
@Override
@Override
public
boolean
preHandle
(
HttpServletRequest
req
,
HttpServletResponse
resp
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
req
,
HttpServletResponse
resp
,
Object
handler
)
throws
Exception
{
if
(
tokenService
.
isLogin
())
{
if
(
tokenService
.
isLogin
())
{
tokenService
.
doLog
(
req
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
else
{
}
else
{
String
sessionid
=
null
;
String
sessionid
=
null
;
...
@@ -33,7 +32,6 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
...
@@ -33,7 +32,6 @@ public class UserLoginInterceptor extends HandlerInterceptorAdapter {
}
}
}
}
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
if
(
sessionid
!=
null
&&
tokenService
.
isLoginByToken
(
sessionid
))
{
tokenService
.
doLog
(
req
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
}
throw
new
XRException
(
"用户未登陆"
,
300
);
throw
new
XRException
(
"用户未登陆"
,
300
);
...
...
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