Interface TokenClient


public interface TokenClient
TokenClient defines the interface for a stateful web token by using persistence and expiration validation.
  • Method Details

    • shutdownClient

      default void shutdownClient()
      shut down client connection
    • set

      default String set(String token, long seconds, String expiration)
      Parameters:
      token - the token
      seconds - for absolute timeout
      expiration - representation of expiration
      Returns:
      the persistence response
    • set

      default String set(String token, String expiration)
      Parameters:
      token - the token
      expiration - representation of expiration
      Returns:
      the persistence response
    • setKeepTTL

      default String setKeepTTL(String token, String expiration)
      Used to postpone expiration but keep existing absolute timeout
      Parameters:
      token - the token
      expiration - representation of expiration
      Returns:
      the persistence response
    • get

      default String get(String token)
      retrieve expiration from persistence
      Parameters:
      token - the token
      Returns:
      expiration or null if token doesn't exist
    • ttl

      default Long ttl(String token)
      retrieve the absolute timeout of token in seconds
      Parameters:
      token - the token to determine ttl for
      Returns:
      the ttl for the token
    • del

      default void del(String... tokens)
      Parameters:
      tokens - the tokens to be removed from persistence