Interface SaslServerContext

All Superinterfaces:
SaslContext

public interface SaslServerContext extends SaslContext
SASL Server operating context used by an Engine that has been configured as a SASL server or that has receiver an AMQP header thereby forcing it into becoming the server side of the SASL exchange.
  • Method Details

    • setListener

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

      SaslServerListener getListener()
      Returns:
      the currently set SaslServerListener instance.
    • sendMechanisms

      SaslServerContext sendMechanisms(Symbol[] mechanisms) throws EngineStateException
      Sends the set of supported mechanisms to the SASL client from which it must choose and return one mechanism which will then be the basis for the SASL authentication negotiation.
      Parameters:
      mechanisms - The mechanisms that this server supports.
      Returns:
      this server context.
      Throws:
      EngineStateException - if the engine has already shutdown or failed while processing the mechanisms.
    • sendMechanisms

      default SaslServerContext sendMechanisms(String[] mechanisms) throws EngineStateException
      Sends the set of supported mechanisms to the SASL client from which it must choose and return one mechanism which will then be the basis for the SASL authentication negotiation.
      Parameters:
      mechanisms - The mechanisms that this server supports.
      Returns:
      this server context.
      Throws:
      EngineStateException - if the engine has already shutdown or failed while processing the mechanisms.
    • sendChallenge

      SaslServerContext sendChallenge(ProtonBuffer challenge) throws EngineStateException
      Sends the SASL challenge defined by the SASL mechanism that is in use during this SASL negotiation. The challenge is an opaque binary that is provided to the server by the security mechanism. Upon sending a challenge the SASL server should expect a response from the SASL client.
      Parameters:
      challenge - The buffer containing the server challenge.
      Returns:
      this server context.
      Throws:
      EngineStateException - if the engine has already shutdown or failed while sending the challenge.
    • sendOutcome

      SaslServerContext sendOutcome(SaslOutcome outcome, ProtonBuffer additional) throws EngineStateException
      Sends a response to a server side challenge that comprises the challenge / response exchange for the chosen SASL mechanism.

      Sending an outcome that indicates SASL does not trigger a failure of the engine or cause a shutdown, the caller must ensure that after failing the SASL exchange the engine is shutdown or failed so that event handlers are triggered or should pro-actively close any I/O channel that was opened. The saslFailure(SaslException) method has no effect once this method has been called as SASL negotiations are considered done once an outcome is sent.

      Parameters:
      outcome - The outcome of the SASL negotiation to be sent to the client.
      additional - The additional bytes to be sent from the server along with the outcome.
      Returns:
      this server context.
      Throws:
      EngineStateException - if the engine has already shutdown or failed while processing the outcome.
    • saslFailure

      SaslServerContext saslFailure(SaslException failure)
      Allows the server 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.

      This method will not perform any action if called after the sendOutcome(SaslOutcome, ProtonBuffer) method has been called as the SASL negotiation process was marked as completed and the implementation is free to tear down SASL resources following that call.

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