类 CachedJwtTokenManager

  • 所有已实现的接口:
    TokenManager

    @Component
    public class CachedJwtTokenManager
    extends java.lang.Object
    implements TokenManager
    Cached JWT token manager.
    作者:
    majorhe
    • 构造器详细资料

      • CachedJwtTokenManager

        public CachedJwtTokenManager()
    • 方法详细资料

      • 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
        从接口复制的说明: TokenManager
        Create 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.AccessException
        Create 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.AccessException
        Get 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.AccessException
        validate 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
        从接口复制的说明: TokenManager
        parse 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
        从接口复制的说明: TokenManager
        validate token.
        指定者:
        getTokenTtlInSeconds 在接口中 TokenManager
        参数:
        token - token
        返回:
        token ttl in seconds
        抛出:
        com.alibaba.nacos.plugin.auth.exception.AccessException - access exception
      • needRefresh

        private boolean needRefresh​(long expiredTimeMills)