Package org.wildfly.security.http.util
Class FilterServerMechanismFactory
- java.lang.Object
-
- org.wildfly.security.http.util.FilterServerMechanismFactory
-
- All Implemented Interfaces:
HttpServerAuthenticationMechanismFactory
public final class FilterServerMechanismFactory extends Object implements HttpServerAuthenticationMechanismFactory
An implementation ofHttpServerAuthenticationMechanismFactory
that wraps an existing factory and provides mechanism filtering by name.- Author:
- Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private HttpServerAuthenticationMechanismFactory
delegate
private Predicate<String>
predicate
-
Constructor Summary
Constructors Constructor Description FilterServerMechanismFactory(HttpServerAuthenticationMechanismFactory delegate, boolean include, String... mechanismNames)
Construct a new instance that filters from a provided set of mechanism names.FilterServerMechanismFactory(HttpServerAuthenticationMechanismFactory delegate, boolean include, Collection<String> mechanismNames)
Construct a new instance that filters from a provided set of mechanism names.FilterServerMechanismFactory(HttpServerAuthenticationMechanismFactory delegate, Predicate<String> predicate)
Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpServerAuthenticationMechanism
createAuthenticationMechanism(String mechanismName, Map<String,?> properties, CallbackHandler callbackHandler)
Create the requestedHttpServerAuthenticationMechanism
provided it is available and allowed by the current filter.String[]
getMechanismNames(Map<String,?> properties)
Get the available mechanism names after filtering has been performed by the previously providedPredicate
-
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
-
delegate
private final HttpServerAuthenticationMechanismFactory delegate
-
-
Constructor Detail
-
FilterServerMechanismFactory
public FilterServerMechanismFactory(HttpServerAuthenticationMechanismFactory delegate, Predicate<String> predicate)
Constructs a new instance.- Parameters:
delegate
- theHttpServerAuthenticationMechanismFactory
to delegate to.predicate
- mechanism name based predicate to filter available mechanisms.
-
FilterServerMechanismFactory
public FilterServerMechanismFactory(HttpServerAuthenticationMechanismFactory delegate, boolean include, String... mechanismNames)
Construct a new instance that filters from a provided set of mechanism names.- Parameters:
delegate
- theHttpServerAuthenticationMechanismFactory
to delegate to.include
- whentrue
mechanisms will be advertised as available if included in the provided mechanismNames.mechanismNames
- the mechanism names to use as a filter.
-
FilterServerMechanismFactory
public FilterServerMechanismFactory(HttpServerAuthenticationMechanismFactory delegate, boolean include, Collection<String> mechanismNames)
Construct a new instance that filters from a provided set of mechanism names.- Parameters:
delegate
- theHttpServerAuthenticationMechanismFactory
to delegate to.include
- whentrue
mechanisms will be advertised as available if included in the provided mechanismNames.mechanismNames
- the mechanism names to use as a filter.
-
-
Method Detail
-
getMechanismNames
public String[] getMechanismNames(Map<String,?> properties)
Get the available mechanism names after filtering has been performed by the previously providedPredicate
- Specified by:
getMechanismNames
in interfaceHttpServerAuthenticationMechanismFactory
- Parameters:
properties
- theMap
of properties to pass into theHttpServerAuthenticationMechanismFactory.getMechanismNames(Map)
call on the delegate.- Returns:
- The array of filtered mechanism names.
- See Also:
HttpServerAuthenticationMechanismFactory.getMechanismNames(java.util.Map)
-
createAuthenticationMechanism
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String,?> properties, CallbackHandler callbackHandler) throws HttpAuthenticationException
Create the requestedHttpServerAuthenticationMechanism
provided it is available and allowed by the current filter.- Specified by:
createAuthenticationMechanism
in interfaceHttpServerAuthenticationMechanismFactory
- Parameters:
mechanismName
- the name of the required mechanism.properties
- the configuration properties to pass in for mechanism creation.callbackHandler
- theCallbackHandler
the mechanism should use for verification.- Returns:
- The
HttpServerAuthenticationMechanism
ornull
if not available. - Throws:
HttpAuthenticationException
- See Also:
HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
-
-