Class SaslMechanismFinder


  • public class SaslMechanismFinder
    extends java.lang.Object
    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.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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)
      Attempts to find a matching Mechanism implementation given a list of supported mechanisms from a remote peer.
      protected static MechanismFactory findMechanismFactory​(java.lang.String name)
      Searches for a MechanismFactory by using the scheme from the given name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SaslMechanismFinder

        public SaslMechanismFinder()
    • 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 none
        password - the password, or null if there is none
        localPrincipal - the Principal associated with the transport, or null if there is none
        mechRestrictions - 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 restriction
        remoteMechanisms - 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.