2.17.2: 2011-06-17

net.sf.basedb.core.authentication
Interface Authenticator

All Known Implementing Classes:
POP3Authenticator, SimpleAuthenticator

public interface Authenticator

This interface defines the methods that needs to be implemented by a class to be able to use it for external authentication against another database or directory service.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Method Summary
 AuthenticationInformation authenticate(String login, String password)
          Authenticates a user.
 void init(String settings)
          Initialises the object.
 boolean supportsExtraInformation()
          Should return TRUE or FALSE depending on if the authentication server returns additional information about the user.
 

Method Detail

init

void init(String settings)
          throws AuthenticationException
Initialises the object. A client application should call this method immediately after object creation with some initialisation parameters. The contents and syntax of the settings string should be defined by the implementing class. It may for example be the URL for a database connection, the path to a properties file or simply the host name of the directory service provider.

Parameters:
settings - A string containing initialisation parameters
Throws:
AuthenticationException - If the parameters are invalid

supportsExtraInformation

boolean supportsExtraInformation()
Should return TRUE or FALSE depending on if the authentication server returns additional information about the user.

Returns:
TRUE if additional information is returned, FALSE otherwise.
See Also:
AuthenticationInformation, authenticate(String,String)

authenticate

AuthenticationInformation authenticate(String login,
                                       String password)
                                       throws UnknownLoginException,
                                              InvalidPasswordException,
                                              AuthenticationException
Authenticates a user. If the authentication succeeds a AuthenticationInformation object should be returned. The only required information in this object is the AuthenticationInformation.id and AuthenticationInformation.login fields. The id may or may not be the same as the login, but must be a unique string identifying the user.

If the authentication fails an exception should be thrown. Note! An implementation may choose to throw a AuthenticationException for all errors, even if it is an unknown user or invalid password.

Parameters:
login - The login name for the user
password - The password for the user
Returns:
An AuthenticationInformation object
Throws:
UnknownLoginException - This exception may be thrown if the server doesn't know about the user. It is also possible for an implmentation to throw an AuthenticationException
InvalidPasswordException - This exception may be thrown if the password is invalid. It is also possible for an implementation to throw an AuthenticationException
AuthenticationException - This exception is thrown if the authentication fails

2.17.2: 2011-06-17