org.figure8.join.businessfacades.security
Class DefaultUserManager

java.lang.Object
  extended by org.figure8.join.businessfacades.security.DefaultUserManager
All Implemented Interfaces:
UserManager

public class DefaultUserManager
extends java.lang.Object
implements UserManager

Default implementation of UserManager.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

Field Summary
protected  UserDao dao
          User data access object
protected  PasswordEncoder passwordEncoder
          Password encryption and check helper object
protected  PermissionManager permissionManager
          Permission manager for retrieving security rghts
 
Constructor Summary
DefaultUserManager()
          Creates a new instance of DefaultUserManager
 
Method Summary
 User getUser(java.lang.String login)
          Retrieves a specific User using its login identifier
 java.util.List getUsers()
          The getUsers method must be used when you want to list all users.
 java.util.List getUsers(java.lang.String lastname)
          The getUsers method must be used when you want to list users using lastname criterion.
 UserView login(java.lang.String userId, java.lang.String userCredential)
          The login method is called when a user wishes to login to the Join application.
 void saveUser(User user)
          Save or update a given user into datastore.
 void setPasswordEncoder(PasswordEncoder encoder)
          The setPasswordEncoder() method must be called during the implementation initialization phase.
 void setPermissionManager(PermissionManager manager)
          The setPermissionManager() method must be called during the implementation initilization phase.
 void setUserDao(UserDao dao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dao

protected UserDao dao
User data access object


passwordEncoder

protected PasswordEncoder passwordEncoder
Password encryption and check helper object


permissionManager

protected PermissionManager permissionManager
Permission manager for retrieving security rghts

Constructor Detail

DefaultUserManager

public DefaultUserManager()
Creates a new instance of DefaultUserManager

Method Detail

setUserDao

public void setUserDao(UserDao dao)
Parameters:
dao - A User data access object

setPasswordEncoder

public void setPasswordEncoder(PasswordEncoder encoder)
The setPasswordEncoder() method must be called during the implementation initialization phase. It must allowed the registration of a PasswordEncoder for the deployed Join application.

Specified by:
setPasswordEncoder in interface UserManager
Parameters:
encoder - Implementation of PaswordEncoder to check and encode users password

setPermissionManager

public void setPermissionManager(PermissionManager manager)
The setPermissionManager() method must be called during the implementation initilization phase. It must allowed the registration of a PermissionManager useful for retrieving security permissions acquired by a user.

Specified by:
setPermissionManager in interface UserManager
Parameters:
manager - Implementation of PermissionManager to retrieve security rights

login

public UserView login(java.lang.String userId,
                      java.lang.String userCredential)
               throws InvalidLoginException
The login method is called when a user wishes to login to the Join application. This method should use the PasswordEncoder validatePassword() method for user's credential validation.

Specified by:
login in interface UserManager
Parameters:
userId - The user identifier.
userCredential - The user credential.
Returns:
A ValueHolder object representing the user's view (data + permissions).
Throws:
InvalidLoginException - if the credentials are invalid.

saveUser

public void saveUser(User user)
              throws DuplicateEntityException
Save or update a given user into datastore.
Warning: this method should be used when first creating a user or when updating a user. In this 2 use-cases, password validation is required so password should be in clear text within the User object.

Specified by:
saveUser in interface UserManager
Parameters:
user - User object to save within datastore
Throws:
DuplicateEntityException - if a user with this login already exists.

getUser

public User getUser(java.lang.String login)
Retrieves a specific User using its login identifier

Specified by:
getUser in interface UserManager
Parameters:
login - The user to retrieve unique login
Returns:
The user having this specified login

getUsers

public java.util.List getUsers()
The getUsers method must be used when you want to list all users.

Specified by:
getUsers in interface UserManager
Returns:
List of org.figure8.join.businessobjects.security.User.

getUsers

public java.util.List getUsers(java.lang.String lastname)
The getUsers method must be used when you want to list users using lastname criterion. Users have their lastname "LIKE" given arguments.

Specified by:
getUsers in interface UserManager
Parameters:
lastname - String to use as criterion for user's lastname
Returns:
List of org.figure8.join.businessobjects.security.User.


Copyright © 2005-2008 Join. All Rights Reserved.