org.itracker.services.authentication
Class DefaultAuthenticator

java.lang.Object
  extended by org.itracker.services.authentication.AbstractPluggableAuthenticator
      extended by org.itracker.services.authentication.DefaultAuthenticator
All Implemented Interfaces:
PluggableAuthenticator, AuthenticationConstants
Direct Known Subclasses:
TestAuthenticator, WindowsSSONAuthenticator

public class DefaultAuthenticator
extends AbstractPluggableAuthenticator

This class provides a default authentication scheme for ITracker. It uses passwords in the user table provided by ITracker to authenticate users. This authenticator allows any user to self register if self registration is available in the system.


Field Summary
 
Fields inherited from interface org.itracker.services.util.AuthenticationConstants
AUTH_TYPE_CERTIFICATE, AUTH_TYPE_PASSWORD_ENC, AUTH_TYPE_PASSWORD_PLAIN, AUTH_TYPE_REQUEST, AUTH_TYPE_SHARED_SECRET, AUTH_TYPE_UNKNOWN, REQ_SOURCE_API, REQ_SOURCE_UNKNOWN, REQ_SOURCE_WEB, UPDATE_TYPE_CORE, UPDATE_TYPE_PERMISSION_ADD, UPDATE_TYPE_PERMISSION_SET, UPDATE_TYPE_PREFERENCE
 
Constructor Summary
DefaultAuthenticator()
           
 
Method Summary
 boolean allowPasswordUpdates(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator always allows password updates.
 boolean allowPermissionUpdates(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator always allows permission updates.
 boolean allowPreferenceUpdates(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator always allows preferences updates.
 boolean allowProfileCreation(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator always allows new user profiles.
 boolean allowProfileUpdates(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator always allows profile updates.
 boolean allowRegistration(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator always allows self registered users.
 User checkLogin(String login, Object authentication, int authType, int reqSource)
          Checks the login of a user against the user profile provided in ITracker.
 boolean createProfile(User user, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator does not make any changes to a newly created profile.
 List<Permission> getUserPermissions(User user, int reqSource)
          The DefaultAuthenticator returns a list of user permissions from the database.
 List<User> getUsersWithProjectPermission(Integer projectId, int[] permissionTypes, boolean requireAll, boolean activeOnly, int reqSource)
          Returns the list of users for a given project.
 boolean updateProfile(User user, int updateType, Object authentication, int authType, int reqSource)
          The DefaultAuthenticator does not make any changes to an updated profile.
 
Methods inherited from class org.itracker.services.authentication.AbstractPluggableAuthenticator
getConfigurationService, getUserService, initialize
 
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

checkLogin

public User checkLogin(String login,
                       Object authentication,
                       int authType,
                       int reqSource)
                throws AuthenticatorException
Checks the login of a user against the user profile provided in ITracker. This is the default authentication scheme provided by ITracker.

Parameters:
login - the login the user/client provided
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
a User if the login is successful
Throws:
AuthenticatorException - an exception if the login is unsuccessful, or an error occurs

getUserPermissions

public List<Permission> getUserPermissions(User user,
                                           int reqSource)
                                    throws AuthenticatorException
The DefaultAuthenticator returns a list of user permissions from the database.

Parameters:
user - a User object that contains the user to retrieve permissions for
reqSource - the source of the request (eg web, api)
Returns:
an array of PermissionModels
Throws:
AuthenticatorException - an error occurs

getUsersWithProjectPermission

public List<User> getUsersWithProjectPermission(Integer projectId,
                                                int[] permissionTypes,
                                                boolean requireAll,
                                                boolean activeOnly,
                                                int reqSource)
                                         throws AuthenticatorException
Returns the list of users for a given project. User permissions can be specified.

Parameters:
projectId - - The Project to search for users
permissionTypes - - User rights to filter
requireAll - - Require all permissions
activeOnly - - Filter users who are active (Possible user status: DELETED, ACTIVE, LOCKED)
reqSource - - not used. TODO: Tagged for removal
Returns:
List of users for the project with filters applied.
Throws:
AuthenticatorException

allowRegistration

public boolean allowRegistration(User user,
                                 Object authentication,
                                 int authType,
                                 int reqSource)
                          throws AuthenticatorException
The DefaultAuthenticator always allows self registered users.

Parameters:
user - a User object that contains the data the user submitted
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
true
Throws:
AuthenticatorException - an exception if an error occurs

allowProfileCreation

public boolean allowProfileCreation(User user,
                                    Object authentication,
                                    int authType,
                                    int reqSource)
                             throws AuthenticatorException
The DefaultAuthenticator always allows new user profiles.

Parameters:
user - a User object that contains the data the user submitted
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
true
Throws:
AuthenticatorException - an exception if an error occurs

allowProfileUpdates

public boolean allowProfileUpdates(User user,
                                   Object authentication,
                                   int authType,
                                   int reqSource)
                            throws AuthenticatorException
The DefaultAuthenticator always allows profile updates.

Parameters:
user - a User object that contains the data the user submitted
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
true
Throws:
AuthenticatorException - an exception if an error occurs
See Also:
PluggableAuthenticator.allowPasswordUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPermissionUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPreferenceUpdates(org.itracker.model.User, java.lang.Object, int, int)

allowPasswordUpdates

public boolean allowPasswordUpdates(User user,
                                    Object authentication,
                                    int authType,
                                    int reqSource)
                             throws AuthenticatorException
The DefaultAuthenticator always allows password updates.

Parameters:
user - a User object that contains the data the user submitted
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
true
Throws:
AuthenticatorException - an exception if an error occurs
See Also:
PluggableAuthenticator.allowProfileUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPermissionUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPreferenceUpdates(org.itracker.model.User, java.lang.Object, int, int)

allowPermissionUpdates

public boolean allowPermissionUpdates(User user,
                                      Object authentication,
                                      int authType,
                                      int reqSource)
                               throws AuthenticatorException
The DefaultAuthenticator always allows permission updates.

Parameters:
user - a User object that contains the data the user submitted
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
true
Throws:
AuthenticatorException - an exception if an error occurs
See Also:
PluggableAuthenticator.allowProfileUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPasswordUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPreferenceUpdates(org.itracker.model.User, java.lang.Object, int, int)

allowPreferenceUpdates

public boolean allowPreferenceUpdates(User user,
                                      Object authentication,
                                      int authType,
                                      int reqSource)
                               throws AuthenticatorException
The DefaultAuthenticator always allows preferences updates.

Parameters:
user - a User object that contains the data the user submitted
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
true
Throws:
AuthenticatorException - an exception if an error occurs
See Also:
PluggableAuthenticator.allowProfileUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPasswordUpdates(org.itracker.model.User, java.lang.Object, int, int), PluggableAuthenticator.allowPermissionUpdates(org.itracker.model.User, java.lang.Object, int, int)

createProfile

public boolean createProfile(User user,
                             Object authentication,
                             int authType,
                             int reqSource)
                      throws AuthenticatorException
The DefaultAuthenticator does not make any changes to a newly created profile.

Parameters:
user - a User object that contains the newly created profile
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
boolean indicating whther changes to the user were made
Throws:
AuthenticatorException - an error occurs
See Also:
PluggableAuthenticator.updateProfile(org.itracker.model.User, int, java.lang.Object, int, int)

updateProfile

public boolean updateProfile(User user,
                             int updateType,
                             Object authentication,
                             int authType,
                             int reqSource)
                      throws AuthenticatorException
The DefaultAuthenticator does not make any changes to an updated profile.

Parameters:
user - a User object that contains the updated profile
updateType - the type of information that is being updated
authentication - the user's authentication information, if known
authType - the type of authentication information being provided
reqSource - the source of the request (eg web, api)
Returns:
boolean indicating whther changes to the user were made
Throws:
AuthenticatorException - an exception if the login is unsuccessful, or an error occurs


Copyright © 2002-2012 itracker. All Rights Reserved.