Class MechanismConfiguration.Builder

java.lang.Object
org.wildfly.security.auth.server.MechanismConfiguration.Builder
Enclosing class:
MechanismConfiguration

public static final class MechanismConfiguration.Builder extends Object
A builder for authentication mechanism configuration.
  • Method Details

    • setPreRealmRewriter

      public MechanismConfiguration.Builder setPreRealmRewriter(Function<Principal,Principal> preRealmRewriter)
      Set a principal transformer to apply before the realm is selected.
      Parameters:
      preRealmRewriter - a principal transformer to apply before the realm is selected
      Returns:
      this builder
    • setPostRealmRewriter

      public MechanismConfiguration.Builder setPostRealmRewriter(Function<Principal,Principal> postRealmRewriter)
      Set a principal transformer to apply after the realm is selected. Any previously set credential source will be overwritten.
      Parameters:
      postRealmRewriter - a principal transformer to apply after the realm is selected
      Returns:
      this builder
    • setFinalRewriter

      public MechanismConfiguration.Builder setFinalRewriter(Function<Principal,Principal> finalRewriter)
      Set a final principal transformer to apply for this mechanism realm. Any previously set credential source will be overwritten.
      Parameters:
      finalRewriter - a final principal transformer to apply for this mechanism realm
      Returns:
      this builder
    • setRealmMapper

      public MechanismConfiguration.Builder setRealmMapper(RealmMapper realmMapper)
      Sets a realm mapper to be used by the mechanism. Any previously set credential source will be overwritten.
      Parameters:
      realmMapper - a realm mapper to be used by the mechanism
      Returns:
      this builder
    • addMechanismRealm

      public MechanismConfiguration.Builder addMechanismRealm(MechanismRealmConfiguration configuration)
      Adds a configuration for one of realms of this mechanism.
      Parameters:
      configuration - a configuration for one of realms of this mechanism
      Returns:
      this builder
    • setServerCredential

      public MechanismConfiguration.Builder setServerCredential(Credential credential)
      Set a single server credential. Any previously set credential source will be overwritten.
      Parameters:
      credential - the credential to set (must not be null)
      Returns:
      this builder
    • setServerCredential

      public MechanismConfiguration.Builder setServerCredential(SecurityFactory<? extends Credential> credentialFactory)
      Set a single server credential factory. Any previously set credential source will be overwritten.
      Parameters:
      credentialFactory - the credential factory to set (must not be null)
      Returns:
      this builder
    • setServerCredentialSource

      public MechanismConfiguration.Builder setServerCredentialSource(CredentialSource serverCredentialSource)
      Set the server credential source. Any previously set credential source will be overwritten.
      Parameters:
      serverCredentialSource - the server credential source (must not be null)
      Returns:
      this builder
    • build

      public MechanismConfiguration build()
      Build a new instance. If no mechanism realms are offered, an empty collection should be provided for mechanismRealms; otherwise, if the mechanism only supports one realm, the first will be used. If the mechanism does not support realms, mechanismRealms is ignored.
      Returns:
      a new instance