org.apache.geronimo.javamail.authentication
Interface ClientAuthenticator
- All Known Implementing Classes:
- CramMD5Authenticator, DigestMD5Authenticator, LoginAuthenticator, PlainAuthenticator, SASLAuthenticator
public interface ClientAuthenticator
Simplified version of the Java 5 SaslClient interface. This is used to
implement a javamail authentication framework that mimics the Sasl framework
on a 1.4.2 JVM. Only the methods required by the Javamail code are
implemented here, but it should be a simple migration to the fuller SASL
interface.
Method Summary |
byte[] |
evaluateChallenge(byte[] challenge)
Evaluate a challenge and return a response that can be sent back to the
server. |
String |
getMechanismName()
Return the mechanism name implemented by this authenticator. |
boolean |
hasInitialResponse()
Indicates that the authenticator has data that should be sent when the
authentication process is initiated. |
boolean |
isComplete()
Indicates whether the client believes the challenge/response sequence is
now complete. |
evaluateChallenge
byte[] evaluateChallenge(byte[] challenge)
throws MessagingException
- Evaluate a challenge and return a response that can be sent back to the
server. Bot the challenge information and the response information are
"raw data", minus any special encodings used by the transport. For
example, SMTP DIGEST-MD5 authentication protocol passes information as
Base64 encoded strings. That encoding must be removed before calling
evaluateChallenge() and the resulting respose must be Base64 encoced
before transmission to the server.
It is the authenticator's responsibility to keep track of the state of
the evaluations. That is, if the authentication process requires multiple
challenge/response cycles, then the authenticator needs to keep track of
context of the challenges.
- Parameters:
challenge
- The challenge data.
- Returns:
- An appropriate response for the challenge data.
- Throws:
MessagingException
hasInitialResponse
boolean hasInitialResponse()
- Indicates that the authenticator has data that should be sent when the
authentication process is initiated. For example, the SMTP PLAIN
authentication sends userid/password without waiting for a challenge
response.
If this method returns true, then the initial response is retrieved using
evaluateChallenge() passing null for the challenge information.
- Returns:
- True if the challenge/response process starts with an initial
response on the client side.
isComplete
boolean isComplete()
- Indicates whether the client believes the challenge/response sequence is
now complete.
- Returns:
- true if the client has evaluated what it believes to be the last
challenge, false if there are additional stages to evaluate.
getMechanismName
String getMechanismName()
- Return the mechanism name implemented by this authenticator.
- Returns:
- The string name of the authentication mechanism. This name should
match the names commonly used by the mail servers (e.g., "PLAIN",
"LOGIN", "DIGEST-MD5", etc.).
Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.