Class SaslMechanismSelector
java.lang.Object
org.apache.qpid.protonj2.engine.sasl.client.SaslMechanismSelector
Client side mechanism used to select a matching mechanism from the server offered list of
mechanisms. The client configures the list of allowed
Mechanism names and when the
server mechanisms are offered mechanism is chosen from the allowed set. If the client does
not configure any mechanisms then the selector chooses from all supported Mechanism
types.-
Constructor Summary
ConstructorsConstructorDescriptionSaslMechanismSelector(Collection<String> allowed) SaslMechanismSelector(Set<Symbol> allowed) -
Method Summary
Modifier and TypeMethodDescriptionprotected MechanismcreateMechanism(Symbol name, SaslCredentialsProvider credentials) protected booleanisApplicable(Mechanism candidate, SaslCredentialsProvider credentials) Tests a givenMechanisminstance to determine if it is applicable given the selector configuration and the provided credentials.select(Symbol[] serverMechs, SaslCredentialsProvider credentials) Given a list of SASL mechanism names select a match from the supported types using the configured allowed list and the given credentials.
-
Constructor Details
-
SaslMechanismSelector
public SaslMechanismSelector() -
SaslMechanismSelector
- Parameters:
allowed- ACollectionof SASL mechanism names that are allowed to be used when selecting a matching mechanism.
-
SaslMechanismSelector
- Parameters:
allowed- ASetof SASL mechanism names that are allowed to be used when selecting a matching mechanism.
-
-
Method Details
-
getAllowedMechanisms
- Returns:
- the configured set of allowed SASL
Mechanismnames.
-
select
Given a list of SASL mechanism names select a match from the supported types using the configured allowed list and the given credentials.- Parameters:
serverMechs- The list of mechanisms the server indicates it supports.credentials- ASaslCredentialsProviderused to choose a matching applicable SASLMechanism.- Returns:
- a selected SASL
Mechanisminstance or null if no match is possible.
-
createMechanism
Using the givenMechanismname and the provided credentials create and configure aMechanismfor evaluation by the selector.- Parameters:
name- A mechanism name that matches one of the supported offerings by the remotecredentials- The provided credentials that will be used to perform authentication with the remote.- Returns:
- a new
Mechanisminstance or null the offered mechanism is unsupported.
-
isApplicable
Tests a givenMechanisminstance to determine if it is applicable given the selector configuration and the provided credentials.- Parameters:
candidate- The candidate SASL mechanism to test for applicability.credentials- The provided SASL credentials which will be used when authenticating with the remote.- Returns:
- true if the candidate
Mechanismis applicable given the provided credentials.
-