Class ScramSHA1Mechanism

  • All Implemented Interfaces:
    java.lang.Comparable<Mechanism>, Mechanism

    public class ScramSHA1Mechanism
    extends AbstractMechanism
    Implements the SASL Scram SHA1 authentication Mechanism.
    • Constructor Detail

      • ScramSHA1Mechanism

        public ScramSHA1Mechanism()
    • Method Detail

      • getPriority

        public int getPriority()
        Returns:
        return the relative priority of this SASL mechanism.
      • getName

        public java.lang.String getName()
        Returns:
        the well known name of this SASL mechanism.
      • isApplicable

        public boolean isApplicable​(java.lang.String username,
                                    java.lang.String password,
                                    java.security.Principal localPrincipal)
        Description copied from interface: Mechanism
        Allows the mechanism to determine if it can be used given the authentication provided.
        Parameters:
        username - The user name given to the client for authentication.
        password - The password given to the client for authentication.
        localPrincipal - The local Principal configured for the client for authentication.
        Returns:
        if this Mechanism is able to validate using the given credentials.
      • getInitialResponse

        public byte[] getInitialResponse()
                                  throws javax.security.sasl.SaslException
        Description copied from interface: Mechanism
        Create an initial response based on selected mechanism. May be null if there is no initial response.
        Returns:
        the initial response, or null if there isn't one.
        Throws:
        javax.security.sasl.SaslException - if an error occurs computing the response.
      • getChallengeResponse

        public byte[] getChallengeResponse​(byte[] challenge)
                                    throws javax.security.sasl.SaslException
        Description copied from interface: Mechanism
        Create a response based on a given challenge from the remote peer.
        Parameters:
        challenge - the challenge that this Mechanism should response to.
        Returns:
        the response that answers the given challenge.
        Throws:
        javax.security.sasl.SaslException - if an error occurs computing the response.
      • verifyCompletion

        public void verifyCompletion()
                              throws javax.security.sasl.SaslException
        Description copied from interface: Mechanism
        Verifies that the SASL exchange has completed successfully. This is an opportunity for the mechanism to ensure that all mandatory steps have been completed successfully and to cleanup and resources that are held by this Mechanism.
        Specified by:
        verifyCompletion in interface Mechanism
        Overrides:
        verifyCompletion in class AbstractMechanism
        Throws:
        javax.security.sasl.SaslException - if the outcome of the SASL exchange is not valid for this Mechanism