Interface SaslClientContext
-
- All Superinterfaces:
SaslContext
public interface SaslClientContext extends SaslContext
SASL Client operating context used by anEngine
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.qpid.protonj2.engine.sasl.SaslContext
SaslContext.Role
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SaslClientListener
getListener()
SaslClientContext
saslFailure(javax.security.sasl.SaslException failure)
Allows the client implementation to fail the SASL negotiation process due to some unrecoverable error.SaslClientContext
sendChosenMechanism(Symbol mechanism, java.lang.String host, ProtonBuffer initialResponse)
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.SaslClientContext
sendResponse(ProtonBuffer response)
Sends a response to a server side challenge that comprises the challenge / response exchange for the chosen SASL mechanism.SaslClientContext
sendSASLHeader()
Sends the AMQP Header indicating the desire for SASL negotiations to be commenced on this connection.SaslClientContext
setListener(SaslClientListener listener)
Sets theSaslClientListener
that will be used to driver the client side SASL negotiations with a connected "server".-
Methods inherited from interface org.apache.qpid.protonj2.engine.sasl.SaslContext
getAttachments, getChosenMechanism, getHostname, getRole, getSaslOutcome, getSaslState, getServerMechanisms, isClient, isDone, isServer
-
-
-
-
Method Detail
-
setListener
SaslClientContext setListener(SaslClientListener listener)
Sets theSaslClientListener
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 theSaslClientListener
will be notified and allowed to respond.- Parameters:
listener
- TheSaslClientListener
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 aConnection
in order to validation authentication state out of band of the normal open process.- Returns:
- this client context.
- Throws:
EngineStateException
- if theEngine
has been shut down or a failure occurs processing this header.
-
sendChosenMechanism
SaslClientContext sendChosenMechanism(Symbol mechanism, java.lang.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 theEngine
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.- Parameters:
response
- The response bytes to be sent to the server for this cycle.- Returns:
- this client context.
- Throws:
EngineStateException
- if theEngine
has been shut down or a failure occurs processing this response.
-
saslFailure
SaslClientContext saslFailure(javax.security.sasl.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 theEngine
.- Parameters:
failure
- The exception to report to theEngine
that describes the failure.- Returns:
- this client context.
-
-