Package org.apache.qpid.jms.sasl
Class SaslMechanismFinder
java.lang.Object
org.apache.qpid.jms.sasl.SaslMechanismFinder
Used to find a SASL Mechanism that most closely matches the preferred set
of Mechanisms supported by the remote peer.
The Matching mechanism is chosen by first find all instances of SASL
mechanism types that are supported on the remote peer, and then making a
final selection based on the Mechanism in the found set that has the
highest priority value.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MechanismfindMatchingMechanism(String username, String password, Principal localPrincipal, Set<String> mechRestrictions, String... remoteMechanisms) Attempts to find a matching Mechanism implementation given a list of supported mechanisms from a remote peer.protected static MechanismFactoryfindMechanismFactory(String name) Searches for a MechanismFactory by using the scheme from the given name.
-
Constructor Details
-
SaslMechanismFinder
public SaslMechanismFinder()
-
-
Method Details
-
findMatchingMechanism
public static Mechanism findMatchingMechanism(String username, String password, Principal localPrincipal, Set<String> mechRestrictions, String... remoteMechanisms) throws SaslSecurityRuntimeException Attempts to find a matching Mechanism implementation given a list of supported mechanisms from a remote peer. Can return null if no matching Mechanisms are found.- Parameters:
username- the user name, or null if there is nonepassword- the password, or null if there is nonelocalPrincipal- the Principal associated with the transport, or null if there is nonemechRestrictions- The possible mechanism(s) to which the client should restrict its mechanism selection to if offered by the server, or null if there is no restrictionremoteMechanisms- list of mechanism names that are supported by the remote peer.- Returns:
- the best matching Mechanism for the supported remote set.
- Throws:
SaslSecurityRuntimeException- if no matching mechanism can be identified
-
findMechanismFactory
Searches for a MechanismFactory by using the scheme from the given name. The search first checks the local cache of mechanism factories before moving on to search in the classpath.- Parameters:
name- The name of the authentication mechanism to search for.- Returns:
- a mechanism factory instance matching the name, or null if none was created.
-