Class AuthClientCache


  • public class AuthClientCache
    extends Object
    Cache that stores authentication clients to be used for different authentication targets & flows (currently backend and form).
    Since:
    8.0.0
    Author:
    XIMA MEDIA GmbH, Dresden
    • Constructor Detail

      • AuthClientCache

        public AuthClientCache()
    • Method Detail

      • getClients

        public static IAuthenticatorClients getClients​(String authTarget,
                                                       IClientDescriptor clientDescriptor)
        Gets the cached authentication clients for the given authentication target & client descriptor. If no clients were found in the cache then a the creation of a new clients will be attempted. If clients were created successfully, they will be cached. Only active clients will be returned.
        Parameters:
        authTarget - to get client for.
        clientDescriptor - descriptor of the clients
        Returns:
        the cached authentication client.
        Throws:
        IllegalArgumentException - if no client name or an authentication target other than backend or form is given.
      • getClients

        public static Map<String,​IAuthenticatorClients> getClients​(String authTarget,
                                                                         Collection<IClientDescriptor> clientDescriptors)
        Gets the cached authentication clients for the given authentication target & client descriptors. If no clients were found in the cache then a the creation of new clients will be attempted. If clients were created successfully, they will be cached. Only active clients will be returned.
        Parameters:
        authTarget - to get clients for.
        clientDescriptors - descriptors of the clients to get (see IClientDescriptor.getClientName())
        Returns:
        the cached authentication clients as a map. The key for the map entries is the client's name.
        Throws:
        IllegalArgumentException - if an authentication target other than backend or form is given.
      • getOrderedClients

        public static List<IAuthenticatorClients> getOrderedClients​(String authTarget,
                                                                    List<IClientDescriptor> clientDescriptors)
        Gets the cached authentication clients for the given authentication target & client descriptors in the order of the given client descriptors. If no clients were found in the cache then a the creation of new clients will be attempted. If clients were created successfully, they will be cached. Only active clients will be returned.
        Parameters:
        authTarget - to get clients for.
        clientDescriptors - descriptors of the clients to get (see IClientDescriptor.getClientName())
        Returns:
        the cached authentication clients as a list ordered by the given client descriptors.
        Throws:
        IllegalArgumentException - if an authentication target other than backend or form is given.
      • getClientsByName

        public static IAuthenticatorClients getClientsByName​(String authTarget,
                                                             String clientName)
        Gets the cached authentication clients for the given authentication target & client name. If no clients were found in the cache then a the creation of new clients will be attempted. If clients were created successfully, they will be cached. Only active clients will be returned.
        Parameters:
        authTarget - to get client for.
        clientName - name of the client to get (see IClientDescriptor.getClientName())
        Returns:
        the cached authentication client.
        Throws:
        IllegalArgumentException - if no client name or an authentication target other than backend or form is given.
      • getClientsByNames

        public static Map<String,​IAuthenticatorClients> getClientsByNames​(String authTarget,
                                                                                Collection<String> clientNames)
        Gets the cached authentication clients for the given authentication target & client names. If no clients were found in the cache then a the creation of new clients will be attempted. If clients were created successfully, they will be cached. Only active clients will be returned.
        Parameters:
        authTarget - to get clients for.
        clientNames - names of the clients to get (see IClientDescriptor.getClientName())
        Returns:
        the cached authentication clients as a map. The key for the map entries is the client's name.
        Throws:
        IllegalArgumentException - if an authentication target other than backend or form is given.
      • removeClients

        public static void removeClients​(IClientDescriptor clientDescriptor)
      • removeClients

        public static void removeClients​(String clientName)
      • getInstance

        public static org.ehcache.Cache<de.xima.fc.security.cache.AuthClientCacheKey,​de.xima.fc.security.cache.CachedAuthClients> getInstance()
      • shutdown

        public static void shutdown()
        Removes the cache instance
      • init

        public static void init()
        Initializes the cache