Package org.apache.qpid.jms.sasl
Class SaslMechanismFinder
- java.lang.Object
-
- org.apache.qpid.jms.sasl.SaslMechanismFinder
-
public class SaslMechanismFinder extends java.lang.ObjectUsed 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 Constructor Description SaslMechanismFinder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MechanismfindMatchingMechanism(java.lang.String username, java.lang.String password, java.security.Principal localPrincipal, java.util.Set<java.lang.String> mechRestrictions, java.lang.String... remoteMechanisms)Attempts to find a matching Mechanism implementation given a list of supported mechanisms from a remote peer.protected static MechanismFactoryfindMechanismFactory(java.lang.String name)Searches for a MechanismFactory by using the scheme from the given name.
-
-
-
Method Detail
-
findMatchingMechanism
public static Mechanism findMatchingMechanism(java.lang.String username, java.lang.String password, java.security.Principal localPrincipal, java.util.Set<java.lang.String> mechRestrictions, java.lang.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
protected static MechanismFactory findMechanismFactory(java.lang.String name)
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.
-
-