com.netscape.sasl.mechanisms

Class SaslExternal

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

SaslExternal()
Default constructor

Method Summary

byte[]
createInitialResponse()
Retrieves the initial response.
byte[]
evaluateChallenge(byte[] challenge)
Evaluates the challenge data and generates a response.
InputStream
getInputStream(InputStream is)
Retrieves an input stream for the session.
String
getMechanismName()
Returns the name of mechanism driver.
OutputStream
getOutputStream(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.

Constructor Details

SaslExternal

public SaslExternal()
Default constructor

Method Details

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.

getInputStream

public InputStream getInputStream(InputStream is)
            throws 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.

getMechanismName

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

getOutputStream

public OutputStream getOutputStream(OutputStream os)
            throws 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.

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.