JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.authentication
Class PasswordAuthenticator

java.lang.Object
  |
  +--org.objectweb.jac.aspects.authentication.PasswordAuthenticator
All Implemented Interfaces:
Authenticator
Direct Known Subclasses:
FilePasswordAuthenticator, UserPasswordAuthenticator

public abstract class PasswordAuthenticator
extends Object
implements Authenticator

This Authenticator ask for a username and password. The number of allowed attempts to enter a valid (username,password) is configurable. It needs a DisplayContext attribute in order to be able to interact with the user.


Constructor Summary
PasswordAuthenticator()
          The default constructor with 3 retries in case of failing.
PasswordAuthenticator(int retries)
          This constructor can be used to parametrize the number of retries.
 
Method Summary
 void askUsernameAndPassword(String username, String password)
          This empty method is used to popup a dialog on the current display so that the user can fill in the authentication information.
 String authenticate()
          This method perform the authentication by calling the askUserNameAndPassword and checkPassword methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordAuthenticator

public PasswordAuthenticator()
The default constructor with 3 retries in case of failing.


PasswordAuthenticator

public PasswordAuthenticator(int retries)
This constructor can be used to parametrize the number of retries.

Parameters:
retries - the number of retries
Method Detail

authenticate

public String authenticate()
                    throws AuthenticationFailedException
This method perform the authentication by calling the askUserNameAndPassword and checkPassword methods.

Specified by:
authenticate in interface Authenticator
Returns:
the username if the authentication succeded, null otherwise
AuthenticationFailedException
See Also:
askUsernameAndPassword(String,String), #checkPassword(String,String)

askUsernameAndPassword

public void askUsernameAndPassword(String username,
                                   String password)
This empty method is used to popup a dialog on the current display so that the user can fill in the authentication information.

Parameters:
username - the username
password - the password

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli