Interface AccessTokenCache

  • All Known Implementing Classes:
    AccessTokenCacheImpl

    @Validated
    public interface AccessTokenCache
    The access token cache interface.
    Author:
    Christian Bremer
    • Method Detail

      • findAccessToken

        Optional<String> findAccessToken​(@NotNull
                                         @NotNull String key)
        Find not expired access token from cache.
        Parameters:
        key - the key
        Returns:
        the access token
      • putAccessToken

        void putAccessToken​(@NotNull
                            @NotNull String key,
                            @NotNull
                            @NotNull String accessToken)
        Put new access token into the cache.
        Parameters:
        key - the key
        accessToken - the access token
      • isExpired

        static boolean isExpired​(@NotNull
                                 @NotNull String tokenValue,
                                 Duration accessTokenThreshold)
        Checks whether the access token is expired. If no expiration claim is present, the result will always be true.
        Parameters:
        tokenValue - the token value
        accessTokenThreshold - the access token threshold
        Returns:
        the boolean
      • getExpirationTime

        static Date getExpirationTime​(@NotNull
                                      @NotNull String tokenValue)
        Gets expiration time.
        Parameters:
        tokenValue - the token value
        Returns:
        the expiration time or null if there is no expiration claim
      • parse

        static com.nimbusds.jwt.JWT parse​(@NotNull
                                          @NotNull String tokenValue)
        Parse jwt.
        Parameters:
        tokenValue - the token value
        Returns:
        the jwt