Interface UserManager

All Superinterfaces:
Serializable
All Known Subinterfaces:
TurbineUserManager
All Known Implementing Classes:
AbstractUserManager

public interface UserManager extends Serializable
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
    Modifier and Type
    Field
    Description
    static final String
    Avalon role - used to id the component within the manager
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends User>
    T
    addUser(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
    Determines if the User exists in the security system.
    void
    forcePassword(User user, String password)
    Forcibly sets new password for an User.
    <T extends AccessControlList>
    T
    getACL(User user)
    Return a Class object representing the system's chosen implementation of of ACL interface.
    <T extends User>
    UserSet<T>
    Retrieves all users defined in the system.
    <T extends User>
    T
    getUser(String username)
    Retrieve a user from persistent storage using username as the key.
    <T extends User>
    T
    getUser(String username, String password)
    Retrieve a user from persistent storage using username as the key, and authenticate the user.
    <T extends User>
    T
    Retrieve a user from persistent storage using the id as the key.
    <T extends User>
    T
    Construct a blank User object.
    <T extends User>
    T
    Construct a blank User object.
    void
    Removes an user account from the system.
    <T extends User>
    UserSet<T>
    Retrieve a list of users that meet the specified criteria.
    void
    saveUser(User user)
    Saves User's data in the permanent storage.
  • Field Details

    • ROLE

      static final String ROLE
      Avalon role - used to id the component within the manager
  • Method Details

    • 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 the User exists in the security system.
      Parameters:
      user - a User 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.
    • retrieveUserList

      <T extends User> UserSet<T> retrieveUserList(Object criteria) throws DataBackendException
      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

      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

      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.