Schnittstelle UserManager
- Alle bekannten Implementierungsklassen:
DefaultUserManager
,PassiveUserManager
public interface UserManager
An UserManager performs
User
objects
related tasks on behalf of the
DefaultSecurityService
.
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$
- Autor:
- Rafal Krzewski, Henning P. Schmiedehausen
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
accountExists
(String userName) Check whether a specified user's account exists.boolean
accountExists
(User user) Check whether a specified user's account exists.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.void
createAccount
(User user, String initialPassword) Creates new user account with specified attributes.void
forcePassword
(User user, String password) Forcibly sets new password for an User.<A extends org.apache.fulcrum.security.acl.AccessControlList>
AReturn a Class object representing the system's chosen implementation of of ACL interface for the given user<U extends User>
UConstructs an User object to represent an anonymous user of the application.<U extends User>
UConstruct a blank User object.<U extends User>
UgetUserInstance
(String userName) Construct a blank User object.void
init
(org.apache.commons.configuration2.Configuration conf) Initializes the UserManagerboolean
Checks whether a passed user object matches the anonymous user pattern according to the configured user managervoid
removeAccount
(User user) Removes an user account from the system.<U extends User>
URetrieve a user from persistent storage using username as the key.<U extends User>
URetrieve a user from persistent storage using username as the key, and authenticate the user.retrieveList
(Object criteria) Retrieve a list of users that meet the specified criteria.void
saveOnSessionUnbind
(User user) Saves User data when the session is unbound.void
Save an User object to persistent storage.
-
Methodendetails
-
init
Initializes the UserManager- Parameter:
conf
- A Configuration object to init this Manager- Löst aus:
InitializationException
- When something went wrong.
-
accountExists
Check whether a specified user's account exists. The login name is used for looking up the account.- Parameter:
user
- The user to be checked.- Gibt zurück:
- true if the specified account exists
- Löst aus:
org.apache.fulcrum.security.util.DataBackendException
- if there was an error accessing the data backend.
-
accountExists
Check whether a specified user's account exists. The login name is used for looking up the account.- Parameter:
userName
- The name of the user to be checked.- Gibt zurück:
- true if the specified account exists
- Löst aus:
org.apache.fulcrum.security.util.DataBackendException
- if there was an error accessing the data backend.
-
retrieve
<U extends User> U retrieve(String username) throws org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.DataBackendException Retrieve a user from persistent storage using username as the key.- Typparameter:
U
- user class- Parameter:
username
- the name of the user.- Gibt zurück:
- an User object.
- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the user's record does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
retrieveList
List<? extends User> retrieveList(Object criteria) throws org.apache.fulcrum.security.util.DataBackendException Retrieve a list of users that meet the specified criteria. As the keys for the criteria, you should use the constants that are defined inUser
interface, plus the names of the custom attributes you added to your user representation in the data storage. Use verbatim names of the attributes - without table name prefix in case of DB implementation.- Parameter:
criteria
- The criteria of selection.- Gibt zurück:
- a List of users meeting the criteria.
- Löst aus:
org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
retrieve
<U extends User> U retrieve(String username, String password) throws org.apache.fulcrum.security.util.PasswordMismatchException, org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.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.- Typparameter:
U
- user class- Parameter:
username
- the name of the user.password
- the user supplied password.- Gibt zurück:
- an User object.
- Löst aus:
org.apache.fulcrum.security.util.PasswordMismatchException
- if the supplied password was incorrect.org.apache.fulcrum.security.util.UnknownEntityException
- if the user's record does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
store
void store(User user) throws org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.DataBackendException Save an User object to persistent storage. User's record is required to exist in the storage.- Parameter:
user
- an User object to store.- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the user's record does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
saveOnSessionUnbind
void saveOnSessionUnbind(User user) throws org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.DataBackendException Saves User data when the session is unbound. The user account is required to exist in the storage. LastLogin, AccessCounter, persistent pull tools, and any data stored in the permData hashtable that is not mapped to a column will be saved.- Parameter:
user
- the user in the session- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the user's account does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
authenticate
void authenticate(User user, String password) throws org.apache.fulcrum.security.util.PasswordMismatchException, org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.DataBackendException Authenticate an User with the specified password. If authentication is successful the method returns nothing. If there are any problems, exception was thrown.- Parameter:
user
- an User object to authenticate.password
- the user supplied password.- Löst aus:
org.apache.fulcrum.security.util.PasswordMismatchException
- if the supplied password was incorrect.org.apache.fulcrum.security.util.UnknownEntityException
- if the user's record does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
createAccount
void createAccount(User user, String initialPassword) throws org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.EntityExistsException, org.apache.fulcrum.security.util.DataBackendException Creates new user account with specified attributes.- Parameter:
user
- the object describing account to be created.initialPassword
- password for the new user- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the user account cannot be created.org.apache.fulcrum.security.util.DataBackendException
- if there was an error accessing the data backend.org.apache.fulcrum.security.util.EntityExistsException
- if the user account already exists.
-
removeAccount
void removeAccount(User user) throws org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.DataBackendException Removes an user account from the system.- Parameter:
user
- the object describing the account to be removed.- Löst aus:
org.apache.fulcrum.security.util.DataBackendException
- if there was an error accessing the data backend.org.apache.fulcrum.security.util.UnknownEntityException
- if the user account is not present.
-
changePassword
void changePassword(User user, String oldPassword, String newPassword) throws org.apache.fulcrum.security.util.PasswordMismatchException, org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.DataBackendException Change the password for an User.- Parameter:
user
- an User to change password for.oldPassword
- the current password suplied by the user.newPassword
- the current password requested by the user.- Löst aus:
org.apache.fulcrum.security.util.PasswordMismatchException
- if the supplied password was incorrect.org.apache.fulcrum.security.util.UnknownEntityException
- if the user's record does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
forcePassword
void forcePassword(User user, String password) throws org.apache.fulcrum.security.util.UnknownEntityException, org.apache.fulcrum.security.util.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.- Parameter:
user
- an User to change password for.password
- the new password.- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the user's record does not exist in the database.org.apache.fulcrum.security.util.DataBackendException
- if there is a problem accessing the storage.
-
getAnonymousUser
<U extends User> U getAnonymousUser() throws org.apache.fulcrum.security.util.UnknownEntityExceptionConstructs an User object to represent an anonymous user of the application.- Typparameter:
U
- user class- Gibt zurück:
- An anonymous Turbine User.
- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the anonymous User object couldn't be constructed.
-
isAnonymousUser
Checks whether a passed user object matches the anonymous user pattern according to the configured user manager- Parameter:
u
- a user object- Gibt zurück:
- True if this is an anonymous user
-
getUserInstance
Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.- Typparameter:
U
- user class- Gibt zurück:
- an object implementing User interface.
- Löst aus:
org.apache.fulcrum.security.util.DataBackendException
- if the object could not be instantiated.
-
getUserInstance
<U extends User> U getUserInstance(String userName) throws org.apache.fulcrum.security.util.DataBackendException Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.- Typparameter:
U
- user class- Parameter:
userName
- The name of the user.- Gibt zurück:
- an object implementing User interface.
- Löst aus:
org.apache.fulcrum.security.util.DataBackendException
- if the object could not be instantiated.
-
getACL
<A extends org.apache.fulcrum.security.acl.AccessControlList> A getACL(User user) throws org.apache.fulcrum.security.util.UnknownEntityException Return a Class object representing the system's chosen implementation of of ACL interface for the given user- Typparameter:
A
- ACL class- Parameter:
user
- the user- Gibt zurück:
- systems's chosen implementation of ACL interface.
- Löst aus:
org.apache.fulcrum.security.util.UnknownEntityException
- if the implementation of ACL interface could not be determined, or does not exist.
-