Package org.apache.fulcrum.security
Interface UserManager
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
TurbineUserManager
- All Known Implementing Classes:
AbstractUserManager
An UserManager performs
User
objects related tasks on behalf of the
BaseSecurityService
.
The responsibilities of this class include loading data of an user from the
storage and putting them into the
User
objects, saving those data to
the permanent storage, and authenticating users.- Version:
- $Id$
- Author:
- Eric Pugh, Rafal Krzewski
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<T extends User>
TCreates new user account with specified attributes.void
authenticate
(User user, String password) Authenticate an User with the specified password.void
changePassword
(User user, String oldPassword, String newPassword) Change the password for an User.boolean
checkExists
(String userName) Check whether a specified user's account exists.boolean
checkExists
(User user) Determines if theUser
exists in the security system.void
forcePassword
(User user, String password) Forcibly sets new password for an User.<T extends AccessControlList>
TReturn a Class object representing the system's chosen implementation of of ACL interface.Retrieves all users defined in the system.<T extends User>
TRetrieve a user from persistent storage using username as the key.<T extends User>
TRetrieve a user from persistent storage using username as the key, and authenticate the user.<T extends User>
TgetUserById
(Object id) Retrieve a user from persistent storage using the id as the key.<T extends User>
TConstruct a blank User object.<T extends User>
TgetUserInstance
(String userName) Construct a blank User object.void
removeUser
(User user) Removes an user account from the system.retrieveUserList
(Object criteria) Retrieve a list of users that meet the specified criteria.void
Saves User's data in the permanent storage.
-
Field Details
-
ROLE
Avalon role - used to id the component within the manager
-
-
Method Details
-
getUserInstance
Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.- Type Parameters:
T
- User type- Returns:
- an object implementing User interface.
- Throws:
DataBackendException
- if the object could not be instantiated.
-
getUserInstance
Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.- Type Parameters:
T
- User- Parameters:
userName
- The name of the user.- Returns:
- an object implementing User interface.
- Throws:
DataBackendException
- if the object could not be instantiated.
-
checkExists
Determines if theUser
exists in the security system.- Parameters:
user
- aUser
value- Returns:
- true if the user exists in the system, false otherwise
- Throws:
DataBackendException
- when more than one user with the same name exists.
-
checkExists
Check whether a specified user's account exists. The login name is used for looking up the account.- Parameters:
userName
- The name of the user to be checked.- Returns:
- true if the specified account exists
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
getUser
Retrieve a user from persistent storage using username as the key.- Type Parameters:
T
- User- Parameters:
username
- the name of the user.- Returns:
- an User object.
- Throws:
UnknownEntityException
- if the user's record does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
getUserById
Retrieve a user from persistent storage using the id as the key.- Type Parameters:
T
- User- Parameters:
id
- the id of the user.- Returns:
- an User object.
- Throws:
UnknownEntityException
- if the user's record does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
getUser
<T extends User> T getUser(String username, String password) throws PasswordMismatchException, UnknownEntityException, DataBackendException Retrieve a user from persistent storage using username as the key, and authenticate the user. The implementation may chose to authenticate to the server as the user whose data is being retrieved.- Type Parameters:
T
- User- Parameters:
username
- the name of the user.password
- the user supplied password.- Returns:
- an User object.
- Throws:
PasswordMismatchException
- if the supplied password was incorrect.UnknownEntityException
- if the user's record does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
getAllUsers
Retrieves all users defined in the system.- Type Parameters:
T
- User type- Returns:
- the names of all users defined in the system.
- Throws:
DataBackendException
- if there was an error accessing the data backend.
-
retrieveUserList
Retrieve a list of users that meet the specified criteria.- Parameters:
criteria
- The criteria of selection.- Returns:
- a List of users meeting the criteria.
- Throws:
DataBackendException
- if there is a problem accessing the storage.
-
saveUser
Saves User's data in the permanent storage. The user account is required to exist in the storage.- Parameters:
user
- the user object to save- Throws:
UnknownEntityException
- if the user's account does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
authenticate
void authenticate(User user, String password) throws PasswordMismatchException, UnknownEntityException, DataBackendException Authenticate an User with the specified password. If authentication is successful the method returns nothing. If there are any problems, exception was thrown.- Parameters:
user
- an User object to authenticate.password
- the user supplied password.- Throws:
PasswordMismatchException
- if the supplied password was incorrect.UnknownEntityException
- if the user's record does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
addUser
<T extends User> T addUser(T user, String password) throws EntityExistsException, DataBackendException Creates new user account with specified attributes.- Parameters:
user
- the object describing account to be created.password
- The password to use for the object creation- Returns:
- User the user added
- Throws:
DataBackendException
- if there was an error accessing the data backend.EntityExistsException
- if the user account already exists.
-
removeUser
Removes an user account from the system.- Parameters:
user
- the object describing the account to be removed.- Throws:
DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the user account is not present.
-
changePassword
void changePassword(User user, String oldPassword, String newPassword) throws PasswordMismatchException, UnknownEntityException, DataBackendException Change the password for an User.- Parameters:
user
- an User to change password for.oldPassword
- the current password suplied by the user.newPassword
- the current password requested by the user.- Throws:
PasswordMismatchException
- if the supplied password was incorrect.UnknownEntityException
- if the user's record does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
forcePassword
Forcibly sets new password for an User. This is supposed by the administrator to change the forgotten or compromised passwords. Certain implementatations of this feature would require administrative level access to the authenticating server / program.- Parameters:
user
- an User to change password for.password
- the new password.- Throws:
UnknownEntityException
- if the user's record does not exist in the database.DataBackendException
- if there is a problem accessing the storage.
-
getACL
Return a Class object representing the system's chosen implementation of of ACL interface.- Type Parameters:
T
- AccessControlList- Parameters:
user
- the user- Returns:
- systems's chosen implementation of ACL interface.
- Throws:
UnknownEntityException
- if the implementation of ACL interface could not be determined, or does not exist.
-