@Component public class RedisSessionServiceImpl extends Object implements SessionService
| Modifier and Type | Field and Description |
|---|---|
protected RedisSessionClient |
redisSessionClient |
protected SecuritySessionProperties |
securitySessionProperties |
| Constructor and Description |
|---|
RedisSessionServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
bindingSession(String sessionId)
绑定当前线程session
|
Boolean |
flush()
刷新session
1:判断当前session是否失效
2:处理单端单用户登录(一个‘用户账号’的‘手机端’只能有一个在线)
|
Session |
getSession()
获取当前Session
|
Boolean |
hasPermissions(String[] permissions)
是否具有权限
|
Boolean |
hasRoles(String[] roles)
是否具有角色
|
boolean |
isExpired()
session是否失效
|
void |
logout()
登出,需要已登录状态
|
void |
refresh()
刷新session,将最后访问时间与当前时间同步;
|
void |
saveOrUpdateSession(Session session)
新增或修改session;
|
protected SecuritySessionProperties securitySessionProperties
protected RedisSessionClient redisSessionClient
public void saveOrUpdateSession(Session session)
saveOrUpdateSession in interface SessionServicesession - sessionpublic void bindingSession(String sessionId)
bindingSession in interface SessionServicesessionId - public void refresh()
refresh in interface SessionServicepublic Boolean flush()
flush in interface SessionServicepublic void logout()
logout in interface SessionServicepublic Session getSession()
getSession in interface SessionServicepublic boolean isExpired()
isExpired in interface SessionServicepublic Boolean hasRoles(String[] roles)
hasRoles in interface SessionServiceroles - 角色字符串public Boolean hasPermissions(String[] permissions)
hasPermissions in interface SessionServicepermissions - 权限字符串Copyright © 2018 Pivotal Software, Inc.. All rights reserved.