org.apache.jetspeed.security.impl
Class UserManagerImpl

java.lang.Object
  extended by org.apache.jetspeed.security.impl.UserManagerImpl
All Implemented Interfaces:
UserManager

public class UserManagerImpl
extends java.lang.Object
implements UserManager

Implementation for managing users and provides access to the User.

Version:
$Id: UserManagerImpl.java 603894 2007-12-13 11:42:22Z woonsan $
Author:
David Le Strat

Constructor Summary
UserManagerImpl(SecurityProvider securityProvider)
           
UserManagerImpl(SecurityProvider securityProvider, HierarchyResolver roleHierarchyResolver, HierarchyResolver groupHierarchyResolver)
           
UserManagerImpl(SecurityProvider securityProvider, HierarchyResolver roleHierarchyResolver, HierarchyResolver groupHierarchyResolver, java.lang.String anonymousUser)
           
UserManagerImpl(SecurityProvider securityProvider, java.lang.String anonymousUser)
           
 
Method Summary
 void addUser(java.lang.String username, java.lang.String password)
           Add a new user provided a username and password.
 void addUser(java.lang.String username, java.lang.String password, java.lang.String atnProviderName)
           Add a new user provided a username and password in the specified authentication provider store.
 boolean authenticate(java.lang.String username, java.lang.String password)
           Authenticate a user.
protected  void createUser(java.lang.String username, java.lang.String password, java.lang.String atnProviderName, boolean raw)
           
 java.lang.String getAnonymousUser()
           
 User getUser(java.lang.String username)
           Get a Userfor a given username.
 java.util.Iterator getUserNames(java.lang.String filter)
           An iterator of user names, finding users matching the corresponding filter criteria.
 java.util.Iterator getUsers(java.lang.String filter)
           An iterator of Userfinding users matching the corresponding filter criteria.
 java.util.Collection getUsersInGroup(java.lang.String groupFullPathName)
          A collection of User for a specific group.
 java.util.Collection getUsersInRole(java.lang.String roleFullPathName)
           A collection of Userfor all the users in a specific role.
 void importUser(java.lang.String username, java.lang.String password, boolean passThrough)
           Import a new user with username and password and allow to bypass the enconding algorithm
 void importUser(java.lang.String username, java.lang.String password, java.lang.String atnProviderName, boolean passThrough)
           Import a new user with username and password in the specified authentication provider store and allow to bypass the enconding algorithm
 void removeUser(java.lang.String username)
           Remove a user.
 void setPassword(java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)
           Set the user password.
 void setPasswordEnabled(java.lang.String userName, boolean enabled)
           Set the enabled state of the user password credential.
 void setPasswordExpiration(java.lang.String userName, java.sql.Date expirationDate)
           Set the expiration date and the expired flag of the password credential.
 void setPasswordUpdateRequired(java.lang.String userName, boolean updateRequired)
           Set the update required state of the user password credential.
 void setRolesInheritableViaGroups(boolean rolesInheritableViaGroups)
           
 void setUserEnabled(java.lang.String userName, boolean enabled)
          Enable or disable a user.
 boolean userExists(java.lang.String username)
           Whether or not a user exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManagerImpl

public UserManagerImpl(SecurityProvider securityProvider)
Parameters:
securityProvider - The security provider.

UserManagerImpl

public UserManagerImpl(SecurityProvider securityProvider,
                       java.lang.String anonymousUser)
Parameters:
securityProvider - The security provider.
anonymousUser - The anonymous user name

UserManagerImpl

public UserManagerImpl(SecurityProvider securityProvider,
                       HierarchyResolver roleHierarchyResolver,
                       HierarchyResolver groupHierarchyResolver)
Parameters:
securityProvider - The security provider.
roleHierarchyResolver - The role hierachy resolver.
groupHierarchyResolver - The group hierarchy resolver.

UserManagerImpl

public UserManagerImpl(SecurityProvider securityProvider,
                       HierarchyResolver roleHierarchyResolver,
                       HierarchyResolver groupHierarchyResolver,
                       java.lang.String anonymousUser)
Parameters:
securityProvider - The security provider.
roleHierarchyResolver - The role hierachy resolver.
groupHierarchyResolver - The group hierarchy resolver.
anonymousUser - The anonymous user name
Method Detail

getAnonymousUser

public java.lang.String getAnonymousUser()
Specified by:
getAnonymousUser in interface UserManager
Returns:
the name of the anonymous user

setRolesInheritableViaGroups

public void setRolesInheritableViaGroups(boolean rolesInheritableViaGroups)

authenticate

public boolean authenticate(java.lang.String username,
                            java.lang.String password)
Description copied from interface: UserManager

Authenticate a user.

Specified by:
authenticate in interface UserManager
Parameters:
username - The user name.
password - The user password.
Returns:
Whether or not a user is authenticated.
See Also:
UserManager.authenticate(java.lang.String, java.lang.String)

addUser

public void addUser(java.lang.String username,
                    java.lang.String password)
             throws SecurityException
Description copied from interface: UserManager

Add a new user provided a username and password.

Specified by:
addUser in interface UserManager
Parameters:
username - The user name.
password - The password.
Throws:
SecurityException
See Also:
UserManager.addUser(java.lang.String, java.lang.String)

addUser

public void addUser(java.lang.String username,
                    java.lang.String password,
                    java.lang.String atnProviderName)
             throws SecurityException
Description copied from interface: UserManager

Add a new user provided a username and password in the specified authentication provider store.

Specified by:
addUser in interface UserManager
Parameters:
username - The user name.
password - The password.
atnProviderName - The authentication provider name.
Throws:
SecurityException
See Also:
UserManager.addUser(java.lang.String, java.lang.String, java.lang.String)

importUser

public void importUser(java.lang.String username,
                       java.lang.String password,
                       boolean passThrough)
                throws SecurityException
Description copied from interface: UserManager

Import a new user with username and password and allow to bypass the enconding algorithm

Specified by:
importUser in interface UserManager
Parameters:
username - The user name.
password - The password.
passThrough - If true the provided password will not be validated/encoded
Throws:
SecurityException
See Also:
UserManager.importUser(java.lang.String, java.lang.String, boolean)

importUser

public void importUser(java.lang.String username,
                       java.lang.String password,
                       java.lang.String atnProviderName,
                       boolean passThrough)
                throws SecurityException
Description copied from interface: UserManager

Import a new user with username and password in the specified authentication provider store and allow to bypass the enconding algorithm

Specified by:
importUser in interface UserManager
Parameters:
username - The user name.
password - The password.
atnProviderName - The authentication provider name.
passThrough - If true the provided password will not be validated/encoded
Throws:
SecurityException
See Also:
UserManager.importUser(java.lang.String, java.lang.String, java.lang.String, boolean)

createUser

protected void createUser(java.lang.String username,
                          java.lang.String password,
                          java.lang.String atnProviderName,
                          boolean raw)
                   throws SecurityException
Throws:
SecurityException
See Also:
UserManager.addUser(java.lang.String, java.lang.String, java.lang.String)

removeUser

public void removeUser(java.lang.String username)
                throws SecurityException
Description copied from interface: UserManager

Remove a user. If there is a Preferencesnode for profile properties associated to this user, it will be removed as well.

Permissionfor this user will be removed as well.

Specified by:
removeUser in interface UserManager
Parameters:
username - The user name.
Throws:
SecurityException
See Also:
TODO Enforce that only administrators can do this.

userExists

public boolean userExists(java.lang.String username)
Description copied from interface: UserManager

Whether or not a user exists.

Specified by:
userExists in interface UserManager
Parameters:
username - The user name.
Returns:
Whether or not a user exists.
See Also:
UserManager.userExists(java.lang.String)

getUser

public User getUser(java.lang.String username)
             throws SecurityException
Description copied from interface: UserManager

Get a Userfor a given username.

Specified by:
getUser in interface UserManager
Parameters:
username - The username.
Returns:
The User.
Throws:
SecurityException
See Also:
UserManager.getUser(java.lang.String)

getUsers

public java.util.Iterator getUsers(java.lang.String filter)
                            throws SecurityException
Description copied from interface: UserManager

An iterator of Userfinding users matching the corresponding filter criteria.

TODO Complete filter implementation.

Specified by:
getUsers in interface UserManager
Parameters:
filter - The filter used to retrieve matching users.
Returns:
The Iterator of User.
Throws:
SecurityException
See Also:
UserManager.getUsers(java.lang.String)

getUserNames

public java.util.Iterator getUserNames(java.lang.String filter)
                                throws SecurityException
Description copied from interface: UserManager

An iterator of user names, finding users matching the corresponding filter criteria.

TODO Complete filter implementation.

Specified by:
getUserNames in interface UserManager
Parameters:
filter - The filter used to retrieve matching users.
Returns:
The Iterator of User.
Throws:
SecurityException
See Also:
UserManager.getUserNames(java.lang.String)

getUsersInRole

public java.util.Collection getUsersInRole(java.lang.String roleFullPathName)
                                    throws SecurityException
Description copied from interface: UserManager

A collection of Userfor all the users in a specific role.

Specified by:
getUsersInRole in interface UserManager
Parameters:
roleFullPathName - The role name full path (e.g. theRoleName.theRoleNameChild).
Returns:
A Collection of User.
Throws:
SecurityException
See Also:
UserManager.getUsersInRole(java.lang.String)

getUsersInGroup

public java.util.Collection getUsersInGroup(java.lang.String groupFullPathName)
                                     throws SecurityException
Description copied from interface: UserManager

A collection of User for a specific group.

Specified by:
getUsersInGroup in interface UserManager
Parameters:
groupFullPathName - The group name full path (e.g. theGroupName.theGroupChildName).
Returns:
A collection of User.
Throws:
SecurityException
See Also:
UserManager.getUsersInGroup(java.lang.String)

setPassword

public void setPassword(java.lang.String username,
                        java.lang.String oldPassword,
                        java.lang.String newPassword)
                 throws SecurityException
Description copied from interface: UserManager

Set the user password.

Specified by:
setPassword in interface UserManager
Parameters:
username - The user name.
oldPassword - The old password.
newPassword - The new password.
Throws:
SecurityException
See Also:
TODO Enforce that only administrators can do this.

setPasswordEnabled

public void setPasswordEnabled(java.lang.String userName,
                               boolean enabled)
                        throws SecurityException
Description copied from interface: UserManager

Set the enabled state of the user password credential.

Specified by:
setPasswordEnabled in interface UserManager
Parameters:
userName - The user name.
enabled - The enabled state.
Throws:
SecurityException
See Also:
UserManager.setPasswordEnabled(java.lang.String, boolean)

setPasswordUpdateRequired

public void setPasswordUpdateRequired(java.lang.String userName,
                                      boolean updateRequired)
                               throws SecurityException
Description copied from interface: UserManager

Set the update required state of the user password credential.

Specified by:
setPasswordUpdateRequired in interface UserManager
Parameters:
userName - The user name.
updateRequired - The update required state.
Throws:
SecurityException
See Also:
UserManager.setPasswordUpdateRequired(java.lang.String, boolean)

setUserEnabled

public void setUserEnabled(java.lang.String userName,
                           boolean enabled)
                    throws SecurityException
Description copied from interface: UserManager
Enable or disable a user.

Specified by:
setUserEnabled in interface UserManager
Parameters:
userName - The user name
enabled - enabled flag for the user
Throws:
SecurityException
See Also:
UserManager.setUserEnabled(java.lang.String, boolean)

setPasswordExpiration

public void setPasswordExpiration(java.lang.String userName,
                                  java.sql.Date expirationDate)
                           throws SecurityException
Description copied from interface: UserManager

Set the expiration date and the expired flag of the password credential.

If a date equal or before the current date is provided, the expired flag will be set to true, otherwise to false.

Specified by:
setPasswordExpiration in interface UserManager
Parameters:
userName - The user name.
expirationDate - The expiration date to set.
Throws:
SecurityException
See Also:
UserManager.setPasswordExpiration(java.lang.String, java.sql.Date)


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.