Class IAMTokenCache


  • public final class IAMTokenCache
    extends java.lang.Object
    Cache for IAM tokens
    Since:
    27.07.2023
    Author:
    weiland
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  IAMTokenCache.Entry
      cache entry
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      clear all cache entries
      java.util.Optional<IAMTokenCache.Entry> findInvalidEntry​(java.lang.String token)
      search an IAM token in the invalid cache entries
      java.util.Optional<IAMTokenCache.Entry> findValidEntry​(java.lang.String token)
      search an IAM token in the valid cache entries
      static IAMTokenCache get()
      get the instance
      void putInvalidEntry​(java.lang.String token)
      add an invalid token to the cache
      void putValidEntry​(java.lang.String token, de.pisa.psa.com.ext_ema.neoletter.json.UserInfo user_info)
      add a valid token to the cache
      void setExpiresIn​(int seconds)
      set the time when the entries expire
      void setSize​(int size)
      set the cache size
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        public static IAMTokenCache get()
        get the instance
        Returns:
        instance
      • setExpiresIn

        public void setExpiresIn​(int seconds)
        set the time when the entries expire
        Parameters:
        seconds - time in seconds
      • setSize

        public void setSize​(int size)
        set the cache size
        Parameters:
        size - number of elements
      • findValidEntry

        public java.util.Optional<IAMTokenCache.Entry> findValidEntry​(java.lang.String token)
        search an IAM token in the valid cache entries
        Parameters:
        token - token to search
        Returns:
        cache entry
      • findInvalidEntry

        public java.util.Optional<IAMTokenCache.Entry> findInvalidEntry​(java.lang.String token)
        search an IAM token in the invalid cache entries
        Parameters:
        token - token to search
        Returns:
        cache entry
      • putValidEntry

        public void putValidEntry​(java.lang.String token,
                                  de.pisa.psa.com.ext_ema.neoletter.json.UserInfo user_info)
        add a valid token to the cache
        Parameters:
        token - IAM token
        user_info - user information
      • putInvalidEntry

        public void putInvalidEntry​(java.lang.String token)
        add an invalid token to the cache
        Parameters:
        token - IAM token
      • clear

        public void clear()
        clear all cache entries