Class MemoryTokenStore

  • All Implemented Interfaces:
    TokenStore

    public class MemoryTokenStore
    extends Object
    implements TokenStore
    A simple HashMap-based TokenStore. The default TTL is 5 minutes and the max TTL is 1 hour.
    • Constructor Detail

      • MemoryTokenStore

        public MemoryTokenStore()
    • Method Detail

      • add

        public void add​(SecurityToken token)
        Description copied from interface: TokenStore
        Add the given token to the cache. The SecurityTokens getId() identifier will be used to key it in the cache.
        Specified by:
        add in interface TokenStore
        Parameters:
        token - The token to be added
      • add

        public void add​(String identifier,
                        SecurityToken token)
        Description copied from interface: TokenStore
        Add the given token to the cache under the given identifier
        Specified by:
        add in interface TokenStore
        Parameters:
        identifier - The identifier to use to key the SecurityToken in the cache
        token - The token to be added
      • setTTL

        public void setTTL​(long newTtl)
        Set a new (default) TTL value in seconds
        Parameters:
        newTtl - a new (default) TTL value in seconds
      • remove

        public void remove​(String identifier)
        Description copied from interface: TokenStore
        Remove an existing token by its identifier
        Specified by:
        remove in interface TokenStore
      • getToken

        public SecurityToken getToken​(String id)
        Description copied from interface: TokenStore
        Returns the Token of the given identifier
        Specified by:
        getToken in interface TokenStore
        Returns:
        The requested Token identified by the given identifier
      • processTokenExpiry

        protected void processTokenExpiry()