Class ScramClient


  • public final class ScramClient
    extends Object
    A client-side implementation for the SCRAM authentication.
    Author:
    David M. Lloyd
    • Method Detail

      • getMechanism

        public ScramMechanism getMechanism()
        Returns the SCRAM mechanism used for the authentication.
        Returns:
        the SCRAM mechanism used for the authentication.
      • getAuthorizationId

        public String getAuthorizationId()
        Returns the ID of the user to be authorized.
        Returns:
        the ID of the user to be authorized.
      • getBindingType

        public String getBindingType()
        Returns the binding type for the "PLUS" channel binding option.
        Returns:
        the binding type for the "PLUS" channel binding option.
      • getBindingData

        public byte[] getBindingData()
        Returns a copy of the binding data for the "PLUS" channel binding option.
        Returns:
        a copy of the binding data for the "PLUS" channel binding option.
      • handleInitialChallenge

        public ScramFinalClientMessage handleInitialChallenge​(ScramInitialClientMessage initialResponse,
                                                              ScramInitialServerMessage initialChallenge)
                                                       throws AuthenticationMechanismException
        Handles the initial challenge from the server and create a response from the client. The method uses a password credential obtained from the callback handler to derive a salted password, which is then used to generate a client key, stored key, and client proof.
        Parameters:
        initialResponse - the initial client message.
        initialChallenge - the initial server message.
        Returns:
        the final client message.
        Throws:
        AuthenticationMechanismException - if an error occurs while obtaining the password, creating the ScramFinalClientMessage or the mechanism in the initial response or challenge message does not match the mechanism expected by the server