org.apache.geronimo.javamail.authentication
Class SASLAuthenticator

java.lang.Object
  extended by org.apache.geronimo.javamail.authentication.SASLAuthenticator
All Implemented Interfaces:
CallbackHandler, ClientAuthenticator

public class SASLAuthenticator
extends Object
implements ClientAuthenticator, CallbackHandler


Field Summary
protected  SaslClient authenticator
           
protected  boolean complete
           
protected  String password
           
protected  String realm
           
protected  String username
           
 
Constructor Summary
SASLAuthenticator(String[] mechanisms, Properties properties, String protocol, String host, String realm, String authorizationID, String username, String password)
          Main constructor.
 
Method Summary
 byte[] evaluateChallenge(byte[] challenge)
          Evaluate a login challenge, returning the a result string that should satisfy the clallenge.
 String getMechanismName()
          Retrieve the authenticator mechanism name.
 void handle(Callback[] callBacks)
           
 boolean hasInitialResponse()
          Respond to the hasInitialResponse query.
 boolean isComplete()
          Indicate whether the challenge/response process is complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

realm

protected String realm

username

protected String username

password

protected String password

authenticator

protected SaslClient authenticator

complete

protected boolean complete
Constructor Detail

SASLAuthenticator

public SASLAuthenticator(String[] mechanisms,
                         Properties properties,
                         String protocol,
                         String host,
                         String realm,
                         String authorizationID,
                         String username,
                         String password)
                  throws MessagingException
Main constructor.

Parameters:
username - The login user name.
password - The login password.
Throws:
MessagingException
Method Detail

hasInitialResponse

public boolean hasInitialResponse()
Respond to the hasInitialResponse query. We defer this to the Sasl client.

Specified by:
hasInitialResponse in interface ClientAuthenticator
Returns:
The SaslClient response to the same query.

isComplete

public boolean isComplete()
Indicate whether the challenge/response process is complete.

Specified by:
isComplete in interface ClientAuthenticator
Returns:
True if the last challenge has been processed, false otherwise.

getMechanismName

public String getMechanismName()
Retrieve the authenticator mechanism name.

Specified by:
getMechanismName in interface ClientAuthenticator
Returns:
Always returns the string "PLAIN"

evaluateChallenge

public byte[] evaluateChallenge(byte[] challenge)
                         throws MessagingException
Evaluate a login challenge, returning the a result string that should satisfy the clallenge. This is forwarded to the SaslClient, which will use the CallBackHandler to retrieve the information it needs for the given protocol.

Specified by:
evaluateChallenge in interface ClientAuthenticator
Parameters:
challenge - The decoded challenge data, as byte array.
Returns:
A formatted challege response, as an array of bytes.
Throws:
MessagingException

handle

public void handle(Callback[] callBacks)
Specified by:
handle in interface CallbackHandler


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.