Class AuthClientCache

java.lang.Object
de.xima.fc.security.cache.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 Details

    • AuthClientCache

      public AuthClientCache()
  • Method Details

    • getClients

      @Deprecated public static IAuthenticatorClients getClients(IFormAuthContext authCtx, IClientDescriptor clientDescriptor)
      Deprecated.
      since version 8.0.0. This method is only used for form logins. Client creation should be independent of form auth context. Therefore all authenticator plugins should implement the form auth context independent and client cacheable buildGenericAuthClient instead of the deprecated buildFormAuthClient
      Returns the authenticator clients for the given form auth context and client descriptor. In case of plugin authenticators that use the old client creation methods the clients won't be cached because they are not cacheable.
      Parameters:
      authCtx - to get the clients for.
      clientDescriptor - describing the authenticator to get the clients for.
      Returns:
      the clients.
    • 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