Package org.wildfly.security.http.util
Class ServiceLoaderServerMechanismFactory
- java.lang.Object
-
- org.wildfly.security.http.util.ServiceLoaderServerMechanismFactory
-
- All Implemented Interfaces:
HttpServerAuthenticationMechanismFactory
public final class ServiceLoaderServerMechanismFactory extends Object implements HttpServerAuthenticationMechanismFactory
AHttpServerAuthenticationMechanismFactory
which locates further factory implementations by iterating aServiceLoader
- Author:
- Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private ServiceLoader<HttpServerAuthenticationMechanismFactory>
serviceLoader
-
Constructor Summary
Constructors Constructor Description ServiceLoaderServerMechanismFactory(ClassLoader classLoader)
Constructs a new instance, aServiceLoader
will be created from the suppliedClassLoader
ServiceLoaderServerMechanismFactory(ServiceLoader<HttpServerAuthenticationMechanismFactory> serviceLoader)
Constructs a new instance with a previously createdServiceLoader
This class synchronizes on the supplied service loader, if the same is synchronized against outside thenServiceLoader.reload()
can safely be called.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpServerAuthenticationMechanism
createAuthenticationMechanism(String mechanismName, Map<String,?> properties, CallbackHandler callbackHandler)
Obtain an instance of the authentication mechanism requested provided this is allowed by any policy specified within the supplied properties.String[]
getMechanismNames(Map<String,?> properties)
Get the names of the HTTP authentication mechanisms that can be supplied by this factory filtered by the supplied properties.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.http.HttpServerAuthenticationMechanismFactory
shutdown
-
-
-
-
Field Detail
-
serviceLoader
private final ServiceLoader<HttpServerAuthenticationMechanismFactory> serviceLoader
-
-
Constructor Detail
-
ServiceLoaderServerMechanismFactory
public ServiceLoaderServerMechanismFactory(ServiceLoader<HttpServerAuthenticationMechanismFactory> serviceLoader)
Constructs a new instance with a previously createdServiceLoader
This class synchronizes on the supplied service loader, if the same is synchronized against outside thenServiceLoader.reload()
can safely be called.- Parameters:
serviceLoader
- theServiceLoader
to use to locateHttpServerAuthenticationMechanismFactory
instances.
-
ServiceLoaderServerMechanismFactory
public ServiceLoaderServerMechanismFactory(ClassLoader classLoader)
Constructs a new instance, aServiceLoader
will be created from the suppliedClassLoader
- Parameters:
classLoader
- theClassLoader
to use to construct aServiceLoader
.
-
-
Method Detail
-
getMechanismNames
public String[] getMechanismNames(Map<String,?> properties)
Description copied from interface:HttpServerAuthenticationMechanismFactory
Get the names of the HTTP authentication mechanisms that can be supplied by this factory filtered by the supplied properties.- Specified by:
getMechanismNames
in interfaceHttpServerAuthenticationMechanismFactory
- Parameters:
properties
- thenon-null
set of properties to pass configuration to the mechanisms that may be evaluated for mechanism availability.- Returns:
- A
non-null
array of the names of the supported HTTP authentication mechanisms. - See Also:
HttpServerAuthenticationMechanismFactory.getMechanismNames(java.util.Map)
-
createAuthenticationMechanism
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String,?> properties, CallbackHandler callbackHandler) throws HttpAuthenticationException
Description copied from interface:HttpServerAuthenticationMechanismFactory
Obtain an instance of the authentication mechanism requested provided this is allowed by any policy specified within the supplied properties.- Specified by:
createAuthenticationMechanism
in interfaceHttpServerAuthenticationMechanismFactory
- Parameters:
mechanismName
- Thenon-null
name of the mechanism to create.properties
- Thenon-null
set of properties to select and configure the mechanism that may be evaluated for mechanism availability.callbackHandler
- Thenon-null
CallbackHandler
for use by the mechanism during authentication.- Returns:
- the configured
HttpServerAuthenticationMechanism
ornull
if no mechanism could be resolved for the given mechanism name. - Throws:
HttpAuthenticationException
- if there is an error creating the mechanism.- See Also:
HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
-
-