Class TokenManagerInMemory<T extends Token>

  • All Implemented Interfaces:
    TokenManager<T>

    public abstract class TokenManagerInMemory<T extends Token>
    extends Object
    implements TokenManager<T>
    Implements simple token manager, that keeps a single token for each user. If user logs in again, older token is invalidated.
    • Field Detail

      • tokenExpirationMills

        protected final long tokenExpirationMills
        millisecond token expire time
    • Constructor Detail

      • TokenManagerInMemory

        protected TokenManagerInMemory​(long tokenExpirationMills)
    • Method Detail

      • put

        public String put​(T token)
        Description copied from interface: TokenManager
        Creates a new token for the user and returns it. It may add it to the token list or replace the previous one for the user. Never returns null.
        Specified by:
        put in interface TokenManager<T extends Token>
      • getTokenExpirationMills

        public long getTokenExpirationMills()
      • getTokensMap

        public Map<String,​T> getTokensMap()
      • cleanExpired

        @Scheduled(cron="${token.manager.cleaner.cron:0 */1 * * * *}")
        public void cleanExpired()
        clean expired tokens