Package org.apache.fulcrum.security
Interface UserManager
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
TurbineUserManager
- All Known Implementing Classes:
AbstractUserManager
,MemoryTurbineUserManagerImpl
,MemoryUserManagerImpl
,PeerUserManager
,TorqueAbstractUserManager
,TorqueBasicUserManagerImpl
,TorqueDynamicUserManagerImpl
,TorqueTurbineUserManagerImpl
public interface UserManager extends Serializable
An UserManager performsUser
objects related tasks on behalf of theBaseSecurityService
. The responsibilities of this class include loading data of an user from the storage and putting them into theUser
objects, saving those data to the permanent storage, and authenticating users.- Version:
- $Id$
- Author:
- Eric Pugh, Rafal Krzewski
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends User>
TaddUser(T user, String password)
Creates 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>
TgetACL(User user)
Return a Class object representing the system's chosen implementation of of ACL interface.<T extends User>
UserSet<T>getAllUsers()
Retrieves all users defined in the system.<T extends User>
TgetUser(String username)
Retrieve a user from persistent storage using username as the key.<T extends User>
TgetUser(String username, String password)
Retrieve 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>
TgetUserInstance()
Construct 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.void
saveUser(User user)
Saves User's data in the permanent storage.
-
-
-
Method Detail
-
getUserInstance
<T extends User> T getUserInstance() throws DataBackendException
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
<T extends User> T getUserInstance(String userName) throws DataBackendException
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
boolean checkExists(User user) throws DataBackendException
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
boolean checkExists(String userName) throws DataBackendException
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
<T extends User> T getUser(String username) throws UnknownEntityException, DataBackendException
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
<T extends User> T getUserById(Object id) throws UnknownEntityException, DataBackendException
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
<T extends User> UserSet<T> getAllUsers() throws DataBackendException
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.
-
saveUser
void saveUser(User user) throws UnknownEntityException, DataBackendException
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
void removeUser(User user) throws UnknownEntityException, DataBackendException
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
void forcePassword(User user, String password) throws UnknownEntityException, DataBackendException
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
<T extends AccessControlList> T getACL(User user) throws UnknownEntityException
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.
-
-