类 CachedJwtTokenManager
- java.lang.Object
-
- com.alibaba.nacos.plugin.auth.impl.token.impl.CachedJwtTokenManager
-
- 所有已实现的接口:
TokenManager
@Component public class CachedJwtTokenManager extends java.lang.Object implements TokenManager
Cached JWT token manager.- 作者:
- majorhe
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 (专用程序包) static classCachedJwtTokenManager.TokenEntity
-
字段概要
字段 修饰符和类型 字段 说明 private JwtTokenManagerjwtTokenManagerprivate java.util.Map<java.lang.String,CachedJwtTokenManager.TokenEntity>tokenMapkey: token string, value: token entity.private java.util.Map<java.lang.String,CachedJwtTokenManager.TokenEntity>userMapkey: username, value: token entity. cache token created by self.
-
构造器概要
构造器 构造器 说明 CachedJwtTokenManager()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 private voidcleanExpiredToken()java.lang.StringcreateToken(java.lang.String username)Create token.java.lang.StringcreateToken(org.springframework.security.core.Authentication authentication)Create token.org.springframework.security.core.AuthenticationgetAuthentication(java.lang.String token)Get auth Info.longgetTokenTtlInSeconds(java.lang.String token)validate token.longgetTokenValidityInSeconds()validate token.private booleanneedRefresh(long expiredTimeMills)NacosUserparseToken(java.lang.String token)parse token.voidvalidateToken(java.lang.String token)validate token.
-
-
-
字段详细资料
-
tokenMap
private volatile java.util.Map<java.lang.String,CachedJwtTokenManager.TokenEntity> tokenMap
key: token string, value: token entity.
-
userMap
private volatile java.util.Map<java.lang.String,CachedJwtTokenManager.TokenEntity> userMap
key: username, value: token entity. cache token created by self.
-
jwtTokenManager
@Autowired private JwtTokenManager jwtTokenManager
-
-
方法详细资料
-
cleanExpiredToken
@Scheduled(initialDelay=30000L, fixedDelay=60000L) private void cleanExpiredToken()
-
createToken
public java.lang.String createToken(org.springframework.security.core.Authentication authentication) throws com.alibaba.nacos.plugin.auth.exception.AccessException从接口复制的说明:TokenManagerCreate token.- 指定者:
createToken在接口中TokenManager- 参数:
authentication- auth info- 返回:
- token
- 抛出:
com.alibaba.nacos.plugin.auth.exception.AccessException- access exception
-
createToken
public java.lang.String createToken(java.lang.String username) throws com.alibaba.nacos.plugin.auth.exception.AccessExceptionCreate token.- 指定者:
createToken在接口中TokenManager- 参数:
username- auth info- 返回:
- token
- 抛出:
com.alibaba.nacos.plugin.auth.exception.AccessException- access exception
-
getAuthentication
public org.springframework.security.core.Authentication getAuthentication(java.lang.String token) throws com.alibaba.nacos.plugin.auth.exception.AccessExceptionGet auth Info.- 指定者:
getAuthentication在接口中TokenManager- 参数:
token- token- 返回:
- auth info
- 抛出:
com.alibaba.nacos.plugin.auth.exception.AccessException- access exception
-
validateToken
public void validateToken(java.lang.String token) throws com.alibaba.nacos.plugin.auth.exception.AccessExceptionvalidate token.- 指定者:
validateToken在接口中TokenManager- 参数:
token- token- 抛出:
com.alibaba.nacos.plugin.auth.exception.AccessException- access exception
-
parseToken
public NacosUser parseToken(java.lang.String token) throws com.alibaba.nacos.plugin.auth.exception.AccessException
从接口复制的说明:TokenManagerparse token.- 指定者:
parseToken在接口中TokenManager- 参数:
token- token- 返回:
- nacos user object
- 抛出:
com.alibaba.nacos.plugin.auth.exception.AccessException- access exception
-
getTokenTtlInSeconds
public long getTokenTtlInSeconds(java.lang.String token) throws com.alibaba.nacos.plugin.auth.exception.AccessException从接口复制的说明:TokenManagervalidate token.- 指定者:
getTokenTtlInSeconds在接口中TokenManager- 参数:
token- token- 返回:
- token ttl in seconds
- 抛出:
com.alibaba.nacos.plugin.auth.exception.AccessException- access exception
-
getTokenValidityInSeconds
public long getTokenValidityInSeconds()
从接口复制的说明:TokenManagervalidate token.- 指定者:
getTokenValidityInSeconds在接口中TokenManager- 返回:
- token validity in seconds
-
needRefresh
private boolean needRefresh(long expiredTimeMills)
-
-