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
9e266d40
Commit
9e266d40
authored
Oct 09, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
0d1226fc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
38 deletions
+59
-38
AbstractTokenService.java
...va/com/egolm/film/login/service/AbstractTokenService.java
+0
-32
AdminTokenServiceImpl.java
.../egolm/film/login/service/impl/AdminTokenServiceImpl.java
+19
-2
MemberTokenServiceImpl.java
...egolm/film/login/service/impl/MemberTokenServiceImpl.java
+20
-2
UserTokenServiceImpl.java
...m/egolm/film/login/service/impl/UserTokenServiceImpl.java
+20
-2
No files found.
src/main/java/com/egolm/film/login/service/AbstractTokenService.java
deleted
100644 → 0
View file @
0d1226fc
package
com
.
egolm
.
film
.
login
.
service
;
import
javax.servlet.http.HttpSession
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.model.LoginToken
;
public
abstract
class
AbstractTokenService
implements
UserTokenService
{
@Override
public
LoginToken
getToken
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
LoginToken
token
=
(
LoginToken
)
session
.
getAttribute
(
TOKEN_NAME
);
return
token
;
}
@Override
abstract
public
LoginToken
doLogin
(
String
username
,
String
password
);
@Override
public
void
doLogout
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
session
.
removeAttribute
(
TOKEN_NAME
);
session
.
invalidate
();
}
@Override
public
boolean
isLogin
()
{
return
this
.
getToken
()
!=
null
;
}
}
src/main/java/com/egolm/film/login/service/impl/AdminTokenServiceImpl.java
View file @
9e266d40
...
@@ -12,11 +12,11 @@ import com.egolm.common.StringUtil;
...
@@ -12,11 +12,11 @@ import com.egolm.common.StringUtil;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.login.service.A
bstract
TokenService
;
import
com.egolm.film.login.service.A
dmin
TokenService
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
@Service
@Service
public
class
AdminTokenServiceImpl
extends
Abstract
TokenService
{
public
class
AdminTokenServiceImpl
implements
Admin
TokenService
{
@Autowired
@Autowired
private
JdbcTemplate
jdbcTemplate
;
private
JdbcTemplate
jdbcTemplate
;
...
@@ -51,5 +51,22 @@ public class AdminTokenServiceImpl extends AbstractTokenService {
...
@@ -51,5 +51,22 @@ public class AdminTokenServiceImpl extends AbstractTokenService {
}
}
}
}
@Override
public
LoginToken
getToken
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
LoginToken
token
=
(
LoginToken
)
session
.
getAttribute
(
TOKEN_NAME
);
return
token
;
}
@Override
public
void
doLogout
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
session
.
removeAttribute
(
TOKEN_NAME
);
session
.
invalidate
();
}
@Override
public
boolean
isLogin
()
{
return
this
.
getToken
()
!=
null
;
}
}
}
src/main/java/com/egolm/film/login/service/impl/MemberTokenServiceImpl.java
View file @
9e266d40
...
@@ -12,11 +12,11 @@ import com.egolm.common.StringUtil;
...
@@ -12,11 +12,11 @@ import com.egolm.common.StringUtil;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.login.service.
Abstract
TokenService
;
import
com.egolm.film.login.service.
Member
TokenService
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
@Service
@Service
public
class
MemberTokenServiceImpl
extends
Abstract
TokenService
{
public
class
MemberTokenServiceImpl
implements
Member
TokenService
{
@Autowired
@Autowired
private
JdbcTemplate
jdbcTemplate
;
private
JdbcTemplate
jdbcTemplate
;
...
@@ -51,4 +51,22 @@ public class MemberTokenServiceImpl extends AbstractTokenService {
...
@@ -51,4 +51,22 @@ public class MemberTokenServiceImpl extends AbstractTokenService {
}
}
}
}
@Override
public
LoginToken
getToken
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
LoginToken
token
=
(
LoginToken
)
session
.
getAttribute
(
TOKEN_NAME
);
return
token
;
}
@Override
public
void
doLogout
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
session
.
removeAttribute
(
TOKEN_NAME
);
session
.
invalidate
();
}
@Override
public
boolean
isLogin
()
{
return
this
.
getToken
()
!=
null
;
}
}
}
src/main/java/com/egolm/film/login/service/impl/UserTokenServiceImpl.java
View file @
9e266d40
...
@@ -12,11 +12,11 @@ import com.egolm.common.StringUtil;
...
@@ -12,11 +12,11 @@ import com.egolm.common.StringUtil;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.login.service.
Abstract
TokenService
;
import
com.egolm.film.login.service.
User
TokenService
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.model.LoginToken
;
@Service
@Service
public
class
UserTokenServiceImpl
extends
Abstract
TokenService
{
public
class
UserTokenServiceImpl
implements
User
TokenService
{
@Autowired
@Autowired
private
JdbcTemplate
jdbcTemplate
;
private
JdbcTemplate
jdbcTemplate
;
...
@@ -51,4 +51,22 @@ public class UserTokenServiceImpl extends AbstractTokenService {
...
@@ -51,4 +51,22 @@ public class UserTokenServiceImpl extends AbstractTokenService {
}
}
}
}
@Override
public
LoginToken
getToken
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
LoginToken
token
=
(
LoginToken
)
session
.
getAttribute
(
TOKEN_NAME
);
return
token
;
}
@Override
public
void
doLogout
()
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
session
.
removeAttribute
(
TOKEN_NAME
);
session
.
invalidate
();
}
@Override
public
boolean
isLogin
()
{
return
this
.
getToken
()
!=
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