org.ofbiz.common.authentication.api
Interface Authenticator

All Known Implementing Classes:
CrowdAuthenticator, TestFailAuthenticator, TestPassAuthenticator

public interface Authenticator

Authenticator Classes which implement this interface (directly) will be auto-discovered and loaded as Authenticators as long as isEnabled() returns true. All implementations MUST be in the org.ofbiz top level package in order to be discovered.


Method Summary
 boolean authenticate(java.lang.String username, java.lang.String password, boolean isServiceAuth)
          Method to authenticate a user
 float getWeight()
          Weight of this authenticator (lower weights are run first)
 void initialize(LocalDispatcher dispatcher)
          Method called when authenticator is first initialized (the delegator object can be obtained from the LocalDispatcher)
 boolean isEnabled()
          Flag to test if this Authenticator is enabled
 boolean isSingleAuthenticator()
          Is this expected to be the only authenticator, if so errors will be thrown when users cannot be found
 boolean isUserSynchronized()
          Is the user synchronized back to OFBiz
 void logout(java.lang.String username)
          Logs a user out
 void syncUser(java.lang.String username)
          Reads user information and syncs it to OFBiz (i.e.
 void updatePassword(java.lang.String username, java.lang.String password, java.lang.String newPassword)
          Updates a user's password
 

Method Detail

initialize

void initialize(LocalDispatcher dispatcher)
Method called when authenticator is first initialized (the delegator object can be obtained from the LocalDispatcher)

Parameters:
dispatcher - The LocalDispatcher to use for this Authenticator

authenticate

boolean authenticate(java.lang.String username,
                     java.lang.String password,
                     boolean isServiceAuth)
                     throws AuthenticatorException
Method to authenticate a user

Parameters:
username - User's username
password - User's password
isServiceAuth - true if authentication is for a service call
Returns:
true if the user is authenticated
Throws:
AuthenticatorException - when a fatal error occurs during authentication

logout

void logout(java.lang.String username)
            throws AuthenticatorException
Logs a user out

Parameters:
username - User's username
Throws:
AuthenticatorException - when logout fails

syncUser

void syncUser(java.lang.String username)
              throws AuthenticatorException
Reads user information and syncs it to OFBiz (i.e. UserLogin, Person, etc) Note: when creating a UserLogin object, be sure to set 'externalAuthId'

Parameters:
username - User's username
Throws:
AuthenticatorException - user synchronization fails

updatePassword

void updatePassword(java.lang.String username,
                    java.lang.String password,
                    java.lang.String newPassword)
                    throws AuthenticatorException
Updates a user's password

Parameters:
username - User's username
password - User's current password
newPassword - User's new password
Throws:
AuthenticatorException - when update password fails

getWeight

float getWeight()
Weight of this authenticator (lower weights are run first)

Returns:
the weight of this Authenticator

isUserSynchronized

boolean isUserSynchronized()
Is the user synchronized back to OFBiz

Returns:
true if the user record is copied to the OFB database

isSingleAuthenticator

boolean isSingleAuthenticator()
Is this expected to be the only authenticator, if so errors will be thrown when users cannot be found

Returns:
true if this is expected to be the only Authenticator

isEnabled

boolean isEnabled()
Flag to test if this Authenticator is enabled

Returns:
true if the Authenticator is enabled