Class FilterServerMechanismFactory

java.lang.Object
org.wildfly.security.http.util.FilterServerMechanismFactory
All Implemented Interfaces:
org.wildfly.security.http.HttpServerAuthenticationMechanismFactory

public final class FilterServerMechanismFactory extends Object implements org.wildfly.security.http.HttpServerAuthenticationMechanismFactory
An implementation of HttpServerAuthenticationMechanismFactory that wraps an existing factory and provides mechanism filtering by name.
Author:
Darran Lofthouse
  • Constructor Details

    • FilterServerMechanismFactory

      public FilterServerMechanismFactory(org.wildfly.security.http.HttpServerAuthenticationMechanismFactory delegate, Predicate<String> predicate)
      Constructs a new instance.
      Parameters:
      delegate - the HttpServerAuthenticationMechanismFactory to delegate to.
      predicate - mechanism name based predicate to filter available mechanisms.
    • FilterServerMechanismFactory

      public FilterServerMechanismFactory(org.wildfly.security.http.HttpServerAuthenticationMechanismFactory delegate, boolean include, String... mechanismNames)
      Construct a new instance that filters from a provided set of mechanism names.
      Parameters:
      delegate - the HttpServerAuthenticationMechanismFactory to delegate to.
      include - when true mechanisms will be advertised as available if included in the provided mechanismNames.
      mechanismNames - the mechanism names to use as a filter.
    • FilterServerMechanismFactory

      public FilterServerMechanismFactory(org.wildfly.security.http.HttpServerAuthenticationMechanismFactory delegate, boolean include, Collection<String> mechanismNames)
      Construct a new instance that filters from a provided set of mechanism names.
      Parameters:
      delegate - the HttpServerAuthenticationMechanismFactory to delegate to.
      include - when true mechanisms will be advertised as available if included in the provided mechanismNames.
      mechanismNames - the mechanism names to use as a filter.
  • Method Details

    • getMechanismNames

      public String[] getMechanismNames(Map<String,?> properties)
      Get the available mechanism names after filtering has been performed by the previously provided Predicate
      Specified by:
      getMechanismNames in interface org.wildfly.security.http.HttpServerAuthenticationMechanismFactory
      Parameters:
      properties - the Map of properties to pass into the HttpServerAuthenticationMechanismFactory.getMechanismNames(Map) call on the delegate.
      Returns:
      The array of filtered mechanism names.
      See Also:
      • HttpServerAuthenticationMechanismFactory.getMechanismNames(java.util.Map)
    • createAuthenticationMechanism

      public org.wildfly.security.http.HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String,?> properties, CallbackHandler callbackHandler) throws org.wildfly.security.http.HttpAuthenticationException
      Create the requested HttpServerAuthenticationMechanism provided it is available and allowed by the current filter.
      Specified by:
      createAuthenticationMechanism in interface org.wildfly.security.http.HttpServerAuthenticationMechanismFactory
      Parameters:
      mechanismName - the name of the required mechanism.
      properties - the configuration properties to pass in for mechanism creation.
      callbackHandler - the CallbackHandler the mechanism should use for verification.
      Returns:
      The HttpServerAuthenticationMechanism or null if not available.
      Throws:
      org.wildfly.security.http.HttpAuthenticationException
      See Also:
      • HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism(java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)