Interface SaslClientContext

All Superinterfaces:
SaslContext

public interface SaslClientContext extends SaslContext
SASL Client operating context used by an Engine that has been configured as a SASL client or that has initialed the SASL exchange by being the first to initiate the AMQP header exchange.
  • Method Details

    • setListener

      SaslClientContext setListener(SaslClientListener listener)
      Sets the SaslClientListener that will be used to driver the client side SASL negotiations with a connected "server". As the server initiates or responds to the various phases of the SASL negotiation the SaslClientListener will be notified and allowed to respond.
      Parameters:
      listener - The SaslClientListener to use for SASL negotiations, cannot be null.
      Returns:
      this client context.
    • getListener

      SaslClientListener getListener()
      Returns:
      the currently set SaslClientListener instance.
    • sendSASLHeader

      SaslClientContext sendSASLHeader() throws EngineStateException
      Sends the AMQP Header indicating the desire for SASL negotiations to be commenced on this connection. The hosting application my wish to start SASL negotiations prior to opening a Connection in order to validation authentication state out of band of the normal open process.
      Returns:
      this client context.
      Throws:
      EngineStateException - if the Engine has been shut down or a failure occurs processing this header.
    • sendChosenMechanism

      SaslClientContext sendChosenMechanism(Symbol mechanism, String host, ProtonBuffer initialResponse) throws EngineStateException
      Sends a response to the SASL server indicating the chosen mechanism for this client and the host name that this client is identifying itself as.
      Parameters:
      mechanism - The chosen mechanism selected from the list the server provided.
      host - The host name that the client is identified as or null if none selected.
      initialResponse - The initial response data sent as defined by the chosen mechanism or null if none required.
      Returns:
      this client context.
      Throws:
      EngineStateException - if the Engine has been shut down or a failure occurs processing this mechanism.
    • sendChosenMechanism

      default SaslClientContext sendChosenMechanism(String mechanism, String host, ProtonBuffer initialResponse) throws EngineStateException
      Sends a response to the SASL server indicating the chosen mechanism for this client and the host name that this client is identifying itself as.
      Parameters:
      mechanism - The chosen mechanism selected from the list the server provided.
      host - The host name that the client is identified as or null if none selected.
      initialResponse - The initial response data sent as defined by the chosen mechanism or null if none required.
      Returns:
      this client context.
      Throws:
      EngineStateException - if the Engine has been shut down or a failure occurs processing this mechanism.
    • sendResponse

      SaslClientContext sendResponse(ProtonBuffer response) throws EngineStateException
      Sends a response to a server side challenge that comprises the challenge / response exchange for the chosen SASL mechanism. The server may response with another challenge or complete the SASL exchange by sending an outcome.
      Parameters:
      response - The response bytes to be sent to the server for this cycle.
      Returns:
      this client context.
      Throws:
      EngineStateException - if the Engine has been shut down or a failure occurs processing this response.
    • saslFailure

      SaslClientContext saslFailure(SaslException failure)
      Allows the client implementation to fail the SASL negotiation process due to some unrecoverable error. Failing the process will signal the engine that the SASL process has failed and place the engine in a failed state as well as notify the registered error handler for the Engine.

      Once the SASL negotiation completes after an outcome has arrived calling this method will not produce any effect as the SASL layer will be shutdown at this point, this method is for failing negotiations that are ongoing. If a failed SASL outcome arrives the client should take action by shutting down the engine or failing it to trigger an event that is handled or by closing the I/O channel in use.

      Parameters:
      failure - The exception to report to the Engine that describes the failure.
      Returns:
      this client context.