public interface TokenBuilder
Modifier and Type | Method and Description |
---|---|
SecurityToken |
creatNewToken(String username,
String sessionId,
Integer validSeconds,
boolean preventsLogin,
int maxSessions)
创建一个新的token
|
int |
getTokenNum(String username,
boolean isActive,
boolean isExpired)
返回符合条件的token的数量
|
List<SecurityToken> |
loadAllToken(String username,
boolean isOnlyAvailable)
获取所有的token
|
SecurityToken |
loadByTokenValue(String tokenValue)
根据token的值获取token
|
String[] |
parseTokenValue(String tokenValue)
从token值中解析出信息
|
SecurityToken |
refreshExpireTime(String tokenValue)
根据token的值重置token的过期时间点
|
void |
remove(String tokenValue)
根据token的值从列表里移除一个token
|
SecurityToken creatNewToken(String username, String sessionId, Integer validSeconds, boolean preventsLogin, int maxSessions) throws com.yishuifengxiao.common.tool.exception.CustomException
username
- 用户名sessionId
- 会话idvalidSeconds
- token的有效时间,单位为秒preventsLogin
- 在达到最大的token数量限制时是否阻止后面的用户登陆maxSessions
- 最大的token数量com.yishuifengxiao.common.tool.exception.CustomException
- 生成时出现了问题List<SecurityToken> loadAllToken(String username, boolean isOnlyAvailable)
username
- 用户名isOnlyAvailable
- 是否仅返回可用的token的数量int getTokenNum(String username, boolean isActive, boolean isExpired)
username
- 用户名isActive
- token是否处于激活状态isExpired
- token是否已经过期String[] parseTokenValue(String tokenValue) throws com.yishuifengxiao.common.tool.exception.CustomException
从token值中解析出信息
正确的tokenValue解析出来的后的信息为[username,clientId,currentTimeMillis]形式的数组tokenValue
- token值com.yishuifengxiao.common.tool.exception.CustomException
- 非法的token信息SecurityToken loadByTokenValue(String tokenValue) throws com.yishuifengxiao.common.tool.exception.CustomException
tokenValue
- token的值com.yishuifengxiao.common.tool.exception.CustomException
- 非法的token信息void remove(String tokenValue) throws com.yishuifengxiao.common.tool.exception.CustomException
tokenValue
- token的值com.yishuifengxiao.common.tool.exception.CustomException
- 非法的token信息SecurityToken refreshExpireTime(String tokenValue) throws com.yishuifengxiao.common.tool.exception.CustomException
tokenValue
- 令牌内容com.yishuifengxiao.common.tool.exception.CustomException
- 非法的token信息Copyright © 2021. All rights reserved.