Package org.wildfly.security.auth.server
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.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<Principal,Principal>
finalRewriter
private List<MechanismRealmConfiguration>
mechanismRealms
private static MechanismRealmConfiguration[]
NO_REALM_CONFIGS
private Function<Principal,Principal>
postRealmRewriter
private Function<Principal,Principal>
preRealmRewriter
private RealmMapper
realmMapper
private CredentialSource
serverCredentialSource
-
Constructor Summary
Constructors Constructor Description Builder()
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MechanismConfiguration.Builder
addMechanismRealm(MechanismRealmConfiguration configuration)
Adds a configuration for one of realms of this mechanism.MechanismConfiguration
build()
Build a new instance.MechanismConfiguration.Builder
setFinalRewriter(Function<Principal,Principal> finalRewriter)
Set a final principal transformer to apply for this mechanism realm.MechanismConfiguration.Builder
setPostRealmRewriter(Function<Principal,Principal> postRealmRewriter)
Set a principal transformer to apply after the realm is selected.MechanismConfiguration.Builder
setPreRealmRewriter(Function<Principal,Principal> preRealmRewriter)
Set a principal transformer to apply before the realm is selected.MechanismConfiguration.Builder
setRealmMapper(RealmMapper realmMapper)
Sets a realm mapper to be used by the mechanism.MechanismConfiguration.Builder
setServerCredential(Credential credential)
Set a single server credential.MechanismConfiguration.Builder
setServerCredential(SecurityFactory<? extends Credential> credentialFactory)
Set a single server credential factory.MechanismConfiguration.Builder
setServerCredentialSource(CredentialSource serverCredentialSource)
Set the server credential source.
-
-
-
Field Detail
-
NO_REALM_CONFIGS
private static final MechanismRealmConfiguration[] NO_REALM_CONFIGS
-
realmMapper
private RealmMapper realmMapper
-
mechanismRealms
private List<MechanismRealmConfiguration> mechanismRealms
-
serverCredentialSource
private CredentialSource serverCredentialSource
-
-
Method Detail
-
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 benull
)- 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 benull
)- 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 benull
)- Returns:
- this builder
-
build
public MechanismConfiguration build()
Build a new instance. If no mechanism realms are offered, an empty collection should be provided formechanismRealms
; 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
-
-