Package de.xima.fc.security.cache
Class AuthClientCache
- java.lang.Object
-
- de.xima.fc.security.cache.AuthClientCache
-
-
Constructor Summary
Constructors Constructor Description AuthClientCache()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static IAuthenticatorClients
getClients(IFormAuthContext authCtx, IClientDescriptor clientDescriptor)
Deprecated.since version 8.0.0.static IAuthenticatorClients
getClients(String authTarget, IClientDescriptor clientDescriptor)
Gets the cached authentication clients for the given authentication target & client descriptor.static Map<String,IAuthenticatorClients>
getClients(String authTarget, Collection<IClientDescriptor> clientDescriptors)
Gets the cached authentication clients for the given authentication target & client descriptors.static IAuthenticatorClients
getClientsByName(String authTarget, String clientName)
Gets the cached authentication clients for the given authentication target & client name.static Map<String,IAuthenticatorClients>
getClientsByNames(String authTarget, Collection<String> clientNames)
Gets the cached authentication clients for the given authentication target & client names.static org.ehcache.Cache<de.xima.fc.security.cache.AuthClientCacheKey,de.xima.fc.security.cache.CachedAuthClients>
getInstance()
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.static void
init()
Initializes the cachestatic void
registerClientFactory(String authenticationTarget, com.google.common.base.Function<IClientDescriptor,IAuthenticatorClients> clientFactory)
static void
removeClients(IClientDescriptor clientDescriptor)
static void
removeClients(String clientName)
static void
shutdown()
Removes the cache instance
-
-
-
Method Detail
-
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 ofform auth context
. Therefore allauthenticator plugins
should implement the form auth context independent and client cacheablebuildGenericAuthClient
instead of the deprecatedbuildFormAuthClient
Returns theauthenticator clients
for the given form auth context and client descriptor. In case of plugin authenticators that use theold 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 thanbackend
orform
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 (seeIClientDescriptor.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 thanbackend
orform
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 (seeIClientDescriptor.getClientName()
)- Returns:
- the cached authentication clients as a list ordered by the given client descriptors.
- Throws:
IllegalArgumentException
- if an authentication target other thanbackend
orform
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 (seeIClientDescriptor.getClientName()
)- Returns:
- the cached authentication client.
- Throws:
IllegalArgumentException
- if no client name or an authentication target other thanbackend
orform
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 (seeIClientDescriptor.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 thanbackend
orform
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
-
registerClientFactory
public static void registerClientFactory(String authenticationTarget, com.google.common.base.Function<IClientDescriptor,IAuthenticatorClients> clientFactory)
-
-