Class SaslExternal

  • All Implemented Interfaces:
    SaslClient

    public class SaslExternal
    extends java.lang.Object
    implements SaslClient
    This class provides the implementation of the EXTERNAL mechanism driver. This mechanism is passed in the SASL External bind request to retrieve the current result code from the server.
    • Constructor Summary

      Constructors 
      Constructor Description
      SaslExternal()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] createInitialResponse()
      Retrieves the initial response.
      byte[] evaluateChallenge​(byte[] challenge)
      Evaluates the challenge data and generates a response.
      java.io.InputStream getInputStream​(java.io.InputStream is)
      Retrieves an input stream for the session.
      java.lang.String getMechanismName()
      Returns the name of mechanism driver.
      java.io.OutputStream getOutputStream​(java.io.OutputStream os)
      Retrieves an output stream for the session.
      boolean isComplete()
      The method may be called at any time to determine if the authentication process is finished.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SaslExternal

        public SaslExternal()
        Default constructor
    • Method Detail

      • createInitialResponse

        public byte[] createInitialResponse()
                                     throws SaslException
        Retrieves the initial response.
        Specified by:
        createInitialResponse in interface SaslClient
        Returns:
        The possibly null byte array containing the initial response. It is null if the mechanism does not have an initial response.
        Throws:
        SaslException - If an error occurred while creating the initial response.
      • evaluateChallenge

        public byte[] evaluateChallenge​(byte[] challenge)
                                 throws SaslException
        Evaluates the challenge data and generates a response.
        Specified by:
        evaluateChallenge in interface SaslClient
        Parameters:
        challenge - The non-null challenge sent from the server.
        Returns:
        The possibly null reponse to send to the server. It is null if the challenge accompanied a "SUCCESS" status and the challenge only contains data for the client to update its state and no response needs to be sent to the server.
        Throws:
        SaslException - If an error occurred while processing the challenge or generating a response.
      • getMechanismName

        public java.lang.String getMechanismName()
        Returns the name of mechanism driver.
        Specified by:
        getMechanismName in interface SaslClient
        Returns:
        The mechanism name.
      • isComplete

        public boolean isComplete()
        The method may be called at any time to determine if the authentication process is finished.
        Specified by:
        isComplete in interface SaslClient
        Returns:
        true if authentication is complete. For this class, always returns true.
      • getInputStream

        public java.io.InputStream getInputStream​(java.io.InputStream is)
                                           throws java.io.IOException
        Retrieves an input stream for the session. It may return the same stream that is passed in, if no processing is to be done by the client object. This method can only be called if isComplete() returns true.
        Specified by:
        getInputStream in interface SaslClient
        Parameters:
        is - The original input stream for reading from the server.
        Returns:
        An input stream for reading from the server, which may include processing the original stream. For this class, the input parameter is always returned.
        Throws:
        java.io.IOException - If the authentication exchange has not completed or an error occurred while getting the stream.
      • getOutputStream

        public java.io.OutputStream getOutputStream​(java.io.OutputStream os)
                                             throws java.io.IOException
        Retrieves an output stream for the session. It may return the same stream that is passed in, if no processing is to be done by the client object. This method can only be called if isComplete() returns true.
        Specified by:
        getOutputStream in interface SaslClient
        Parameters:
        os - The original output stream for writing to the server.
        Returns:
        An output stream for writing to the server, which may include processing the original stream. For this class, the input parameter is always returned.
        Throws:
        java.io.IOException - If the authentication exchange has not completed or an error occurred while getting the stream.