jboss-sasl 1.0.0.Beta1

org.jboss.sasl.util
Class AbstractSaslClient

java.lang.Object
  extended by org.jboss.sasl.util.AbstractSaslParticipant
      extended by org.jboss.sasl.util.AbstractSaslClient
All Implemented Interfaces:
SaslClient
Direct Known Subclasses:
AnonymousSaslClient, ClientTokenSaslClient

public abstract class AbstractSaslClient
extends AbstractSaslParticipant
implements SaslClient

A base class for SASL client implementations.

Author:
David M. Lloyd

Field Summary
 
Fields inherited from class org.jboss.sasl.util.AbstractSaslParticipant
NO_BYTES
 
Constructor Summary
protected AbstractSaslClient(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse)
          Construct a new instance.
 
Method Summary
 byte[] evaluateChallenge(byte[] challenge)
          Evaluate an authentication challenge received from the server.
protected  String getAuthorizationId()
          Get the specified authorization ID.
 boolean hasInitialResponse()
          Determines whether this mechanism has an optional initial response.
 
Methods inherited from class org.jboss.sasl.util.AbstractSaslParticipant
dispose, getCallbackHandler, getContext, getMechanismName, getNegotiatedProperty, getProtocol, getServerName, getWrapper, handleCallbacks, isComplete, setWrapper, tryHandleCallbacks, unwrap, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.security.sasl.SaslClient
dispose, getMechanismName, getNegotiatedProperty, isComplete, unwrap, wrap
 

Constructor Detail

AbstractSaslClient

protected AbstractSaslClient(String mechanismName,
                             String protocol,
                             String serverName,
                             CallbackHandler callbackHandler,
                             String authorizationId,
                             boolean hasInitialResponse)
Construct a new instance.

Parameters:
mechanismName - the SASL mechanism name
protocol - the protocol
serverName - the server name
callbackHandler - the callback handler to use for authentication
authorizationId - the possibly null protocol-dependent name used for authorization
hasInitialResponse - true if the mechanism supports an initial response, false otherwise
Method Detail

evaluateChallenge

public byte[] evaluateChallenge(byte[] challenge)
                         throws SaslException
Evaluate an authentication challenge received from the server.

Specified by:
evaluateChallenge in interface SaslClient
Parameters:
challenge - the authentication challenge
Returns:
the response to send to the server
Throws:
SaslException - if there is an error processing the server message

hasInitialResponse

public boolean hasInitialResponse()
Determines whether this mechanism has an optional initial response. If true, caller should call evaluateChallenge(byte[]) with an empty array to get the initial response.

Specified by:
hasInitialResponse in interface SaslClient
Returns:
true if this mechanism has an initial response

getAuthorizationId

protected String getAuthorizationId()
Get the specified authorization ID.

Returns:
the authorization ID

jboss-sasl 1.0.0.Beta1

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.