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 ofHttpServerAuthenticationMechanismFactorythat wraps an existing factory and provides mechanism filtering by name.- Author:
- Darran Lofthouse
-
-
Field Summary
Fields Modifier and Type Field Description private HttpServerAuthenticationMechanismFactorydelegateprivate 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 HttpServerAuthenticationMechanismcreateAuthenticationMechanism(String mechanismName, Map<String,?> properties, CallbackHandler callbackHandler)Create the requestedHttpServerAuthenticationMechanismprovided 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- theHttpServerAuthenticationMechanismFactoryto 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- theHttpServerAuthenticationMechanismFactoryto delegate to.include- whentruemechanisms 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- theHttpServerAuthenticationMechanismFactoryto delegate to.include- whentruemechanisms 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:
getMechanismNamesin interfaceHttpServerAuthenticationMechanismFactory- Parameters:
properties- theMapof 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 requestedHttpServerAuthenticationMechanismprovided it is available and allowed by the current filter.- Specified by:
createAuthenticationMechanismin interfaceHttpServerAuthenticationMechanismFactory- Parameters:
mechanismName- the name of the required mechanism.properties- the configuration properties to pass in for mechanism creation.callbackHandler- theCallbackHandlerthe mechanism should use for verification.- Returns:
- The
HttpServerAuthenticationMechanismornullif not available. - Throws:
HttpAuthenticationException- See Also:
HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
-
-