com.crankuptheamps.client
Class DefaultAuthenticator

java.lang.Object
  extended by com.crankuptheamps.client.DefaultAuthenticator
All Implemented Interfaces:
Authenticator

public class DefaultAuthenticator
extends Object
implements Authenticator


Constructor Summary
DefaultAuthenticator()
           
 
Method Summary
 String authenticate(String username_, String currentPassword_)
          Called by AMPS.Client, just before the logon command is sent.
 void completed(String username_, String password_, int reason_)
          Called when a logon completes successfully.
 String retry(String username_, String password_)
          Called when a logon "ack" is received with a status of "retry".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAuthenticator

public DefaultAuthenticator()
Method Detail

authenticate

public String authenticate(String username_,
                           String currentPassword_)
                    throws AuthenticationException
Called by AMPS.Client, just before the logon command is sent.

Specified by:
authenticate in interface Authenticator
Parameters:
username_ - The current value of the username as specified in the URI.
currentPassword_ - The current value of the password, as specified in the URI.
Returns:
The value that should be placed into the Password header field of the logon command.
Throws:
AuthenticationException - An error occured while authenticating.

retry

public String retry(String username_,
                    String password_)
             throws AuthenticationException
Called when a logon "ack" is received with a status of "retry". AMPS will continue trying to logon as long as the server returns "retry", and this method continues to succeed.

Specified by:
retry in interface Authenticator
Parameters:
username_ - The username returned by the server's ACK message.
password_ - The password or token returned in the server's ACK message.
Returns:
The value that should be placed into the Password header for the next logon attempt.
Throws:
AuthenticationException - An error occured while authenticating.

completed

public void completed(String username_,
                      String password_,
                      int reason_)
               throws AuthenticationException
Called when a logon completes successfully. Once a logon has completed, this method is called with the username and password that caused a successful logon

Specified by:
completed in interface Authenticator
Parameters:
username_ - The username that successfully logged on to the server.
password_ - The password that successfully logged on to the server.
reason_ - The reason for this successful completion (from Message.Reasons)
Throws:
AuthenticationException - The client-side authentication module detected an error.