Class SaslImpl

java.lang.Object
org.apache.qpid.proton.engine.impl.SaslImpl
All Implemented Interfaces:
SaslFrameBody.SaslFrameBodyHandler<Void>, TransportLayer, Sasl

public class SaslImpl extends Object implements Sasl, SaslFrameBody.SaslFrameBodyHandler<Void>, TransportLayer
  • Field Details

  • Method Details

    • isDone

      public boolean isDone()
    • recv

      public final int recv(byte[] bytes, int offset, int size)
      Description copied from interface: Sasl
      Read challenge/response/additional data sent from the peer. Use pending to determine the size of the data.
      Specified by:
      recv in interface Sasl
      Parameters:
      bytes - written with up to size bytes of inbound data.
      offset - the offset in the array to begin writing at
      size - maximum number of bytes that bytes can accept.
      Returns:
      The number of bytes written to bytes, or an error code if < 0.
    • send

      public final int send(byte[] bytes, int offset, int size)
      Description copied from interface: Sasl
      Send challenge/response/additional data to the peer.
      Specified by:
      send in interface Sasl
      Parameters:
      bytes - The challenge/response data.
      offset - the point within the array at which the data starts at
      size - The number of data octets in bytes.
      Returns:
      The number of octets read from bytes, or an error code if < 0
    • pending

      public int pending()
      Description copied from interface: Sasl
      Determine the size of the bytes available via recv(). Returns the size in bytes available via recv().
      Specified by:
      pending in interface Sasl
      Returns:
      The number of bytes available, zero if no available data.
    • getState

      public Sasl.SaslState getState()
      Description copied from interface: Sasl
      Access the current state of the layer.
      Specified by:
      getState in interface Sasl
      Returns:
      The state of the sasl layer.
    • setMechanisms

      public void setMechanisms(String... mechanisms)
      Description copied from interface: Sasl
      Set the acceptable SASL mechanisms for the layer.
      Specified by:
      setMechanisms in interface Sasl
      Parameters:
      mechanisms - a list of acceptable SASL mechanisms
    • getRemoteMechanisms

      public String[] getRemoteMechanisms()
      Description copied from interface: Sasl
      Retrieve the list of SASL mechanisms provided by the remote.
      Specified by:
      getRemoteMechanisms in interface Sasl
      Returns:
      the SASL mechanisms advertised by the remote
    • setMechanism

      public void setMechanism(Symbol mechanism)
    • getChosenMechanism

      public Symbol getChosenMechanism()
    • setResponse

      public void setResponse(Binary initialResponse)
    • handle

      public void handle(SaslFrameBody frameBody, Binary payload)
    • handleInit

      public void handleInit(SaslInit saslInit, Binary payload, Void context)
      Specified by:
      handleInit in interface SaslFrameBody.SaslFrameBodyHandler<Void>
    • handleResponse

      public void handleResponse(SaslResponse saslResponse, Binary payload, Void context)
      Specified by:
      handleResponse in interface SaslFrameBody.SaslFrameBodyHandler<Void>
    • done

      public void done(Sasl.SaslOutcome outcome)
      Description copied from interface: Sasl
      Set the outcome of SASL negotiation Used by the server to set the result of the negotiation process.
      Specified by:
      done in interface Sasl
      Parameters:
      outcome - the outcome of the SASL negotiation
    • handleMechanisms

      public void handleMechanisms(SaslMechanisms saslMechanisms, Binary payload, Void context)
      Specified by:
      handleMechanisms in interface SaslFrameBody.SaslFrameBodyHandler<Void>
    • handleChallenge

      public void handleChallenge(SaslChallenge saslChallenge, Binary payload, Void context)
      Specified by:
      handleChallenge in interface SaslFrameBody.SaslFrameBodyHandler<Void>
    • handleOutcome

      public void handleOutcome(SaslOutcome saslOutcome, Binary payload, Void context)
      Specified by:
      handleOutcome in interface SaslFrameBody.SaslFrameBodyHandler<Void>
    • plain

      public void plain(String username, String password)
      Description copied from interface: Sasl
      Configure the SASL layer to use the "PLAIN" mechanism. A utility function to configure a simple client SASL layer using PLAIN authentication.
      Specified by:
      plain in interface Sasl
      Parameters:
      username - credential for the PLAIN authentication mechanism
      password - credential for the PLAIN authentication mechanism
    • getOutcome

      public Sasl.SaslOutcome getOutcome()
      Description copied from interface: Sasl
      Retrieve the outcome of SASL negotiation.
      Specified by:
      getOutcome in interface Sasl
    • client

      public void client()
      Specified by:
      client in interface Sasl
    • server

      public void server()
      Specified by:
      server in interface Sasl
    • allowSkip

      public void allowSkip(boolean allowSkip)
      Description copied from interface: Sasl
      Set whether servers may accept incoming connections that skip the SASL layer negotiation.
      Specified by:
      allowSkip in interface Sasl
    • wrap

      public TransportWrapper wrap(TransportInput input, TransportOutput output)
      Specified by:
      wrap in interface TransportLayer
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getHostname

      public String getHostname()
      Description copied from interface: Sasl
      Retrieve the hostname indicated by the client when sending its SaslInit.
      Specified by:
      getHostname in interface Sasl
      Returns:
      the hostname indicated by the remote client, or null if none specified.
    • setRemoteHostname

      public void setRemoteHostname(String hostname)
      Description copied from interface: Sasl
      Set the remote hostname to indicate the host being connected to when sending a SaslInit to the server.
      Specified by:
      setRemoteHostname in interface Sasl
    • setListener

      public void setListener(SaslListener saslListener)
      Description copied from interface: Sasl
      Adds a listener to receive notice of frames having arrived.
      Specified by:
      setListener in interface Sasl