Directory SDK
for Java 4.19

com.netscape.sasl.mechanisms
Class SaslExternal

java.lang.Object
  extended bycom.netscape.sasl.mechanisms.SaslExternal
All Implemented Interfaces:
SaslClient

public class SaslExternal
extends 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.
 
Methods inherited from class java.lang.Object
equals, 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 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 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.
Throws:
IOException - If the authentication exchange has not completed or an error occurred while getting the stream.

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.
Throws:
IOException - If the authentication exchange has not completed or an error occurred while getting the stream.

Directory SDK
for Java 4.19

Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.