2.17.2: 2011-06-17

net.sf.basedb.core.authentication
Class SimpleAuthenticator

java.lang.Object
  extended by net.sf.basedb.core.authentication.SimpleAuthenticator
All Implemented Interfaces:
Authenticator

public class SimpleAuthenticator
extends Object
implements Authenticator

This class is an example implementation of the Authenticator interface that authenticates everyone as long as the login is the same as the password. This class should of course never be used in a real environment.

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

Constructor Summary
SimpleAuthenticator()
          Create a new SimpleAuthenticator object.
 
Method Summary
 AuthenticationInformation authenticate(String login, String password)
          If login and password are equal the user is authenticated, otherwise an InvalidPasswordException is thrown.
 void init(String settings)
          There is nothing to initialise.
 boolean supportsExtraInformation()
          Always return FALSE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAuthenticator

public SimpleAuthenticator()
Create a new SimpleAuthenticator object.

Method Detail

init

public void init(String settings)
          throws AuthenticationException
There is nothing to initialise.

Specified by:
init in interface Authenticator
Parameters:
settings - A string containing initialisation parameters
Throws:
AuthenticationException - If the parameters are invalid

supportsExtraInformation

public boolean supportsExtraInformation()
Always return FALSE.

Specified by:
supportsExtraInformation in interface Authenticator
Returns:
TRUE if additional information is returned, FALSE otherwise.
See Also:
AuthenticationInformation, Authenticator.authenticate(String,String)

authenticate

public AuthenticationInformation authenticate(String login,
                                              String password)
                                       throws UnknownLoginException,
                                              InvalidPasswordException,
                                              AuthenticationException
If login and password are equal the user is authenticated, otherwise an InvalidPasswordException is thrown.

Specified by:
authenticate in interface Authenticator
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