org.apache.geronimo.javamail.authentication
Class DigestMD5Authenticator

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

public class DigestMD5Authenticator
extends Object
implements ClientAuthenticator

Process a DIGEST-MD5 authentication, using the challenge/response mechanisms.


Nested Class Summary
 class DigestMD5Authenticator.NameValuePair
          Simple inner class to represent a name/value pair.
 
Field Summary
protected static int AUTHENTICATE_CLIENT
           
protected static int AUTHENTICATE_SERVER
           
protected static int AUTHENTICATION_COMPLETE
           
protected  String authenticationResponse
           
protected  String clientResponse
           
protected  String host
           
protected  String nonce
           
protected  String password
           
protected  String realm
           
protected  ArrayList realms
           
protected  int stage
           
protected  String username
           
 
Constructor Summary
DigestMD5Authenticator(String host, String username, String password, String realm)
          Main constructor.
 
Method Summary
 byte[] authenticateClient(byte[] challenge)
          Evaluate a DIGEST-MD5 login client authentication challenge, returning the a result string that should satisfy the clallenge.
 byte[] authenticateServer(byte[] challenge)
          Evaluate a DIGEST-MD5 login server authentication challenge, returning the a result string that should satisfy the clallenge.
 byte[] evaluateChallenge(byte[] challenge)
          Evaluate a DIGEST-MD5 login challenge, returning the a result string that should satisfy the clallenge.
 String getMechanismName()
          Retrieve the authenticator mechanism name.
 boolean hasInitialResponse()
          Respond to the hasInitialResponse query.
 boolean isComplete()
          Indicate whether the challenge/response process is complete.
protected  boolean parseChallenge(byte[] challenge)
          Parse the challege string, pulling out information required for our challenge response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHENTICATE_CLIENT

protected static final int AUTHENTICATE_CLIENT
See Also:
Constant Field Values

AUTHENTICATE_SERVER

protected static final int AUTHENTICATE_SERVER
See Also:
Constant Field Values

AUTHENTICATION_COMPLETE

protected static final int AUTHENTICATION_COMPLETE
See Also:
Constant Field Values

host

protected String host

username

protected String username

password

protected String password

realm

protected String realm

clientResponse

protected String clientResponse

authenticationResponse

protected String authenticationResponse

realms

protected ArrayList realms

nonce

protected String nonce

stage

protected int stage
Constructor Detail

DigestMD5Authenticator

public DigestMD5Authenticator(String host,
                              String username,
                              String password,
                              String realm)
Main constructor.

Parameters:
host - The server host name.
username - The login user name.
password - The login password.
realm - The target login realm (can be null).
Method Detail

hasInitialResponse

public boolean hasInitialResponse()
Respond to the hasInitialResponse query. This mechanism does not have an initial response.

Specified by:
hasInitialResponse in interface ClientAuthenticator
Returns:
Always returns false.

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 "DIGEST-MD5"

evaluateChallenge

public byte[] evaluateChallenge(byte[] challenge)
                         throws MessagingException
Evaluate a DIGEST-MD5 login challenge, returning the a result string that should satisfy the clallenge.

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

authenticateServer

public byte[] authenticateServer(byte[] challenge)
                          throws MessagingException
Evaluate a DIGEST-MD5 login server authentication challenge, returning the a result string that should satisfy the clallenge.

Parameters:
challenge - The decoded challenge data, as a string.
Returns:
A formatted challege response, as an array of bytes.
Throws:
MessagingException

authenticateClient

public byte[] authenticateClient(byte[] challenge)
                          throws MessagingException
Evaluate a DIGEST-MD5 login client authentication challenge, returning the a result string that should satisfy the clallenge.

Parameters:
challenge - The decoded challenge data, as a string.
Returns:
A formatted challege response, as an array of bytes.
Throws:
MessagingException

parseChallenge

protected boolean parseChallenge(byte[] challenge)
                          throws MessagingException
Parse the challege string, pulling out information required for our challenge response.

Parameters:
challenge - The challenge data.
Returns:
true if there were no errors parsing the string, false otherwise.
Throws:
MessagingException


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