info.magnolia.cms.security
Class ExternalUserManager

java.lang.Object
  extended by info.magnolia.cms.security.ExternalUserManager
All Implemented Interfaces:
UserManager

public class ExternalUserManager
extends Object
implements UserManager

Manages the JAAS users.

Version:
$Revision:9391 $ ($Author:scharles $)
Author:
philipp

Field Summary
 
Fields inherited from interface info.magnolia.cms.security.UserManager
ANONYMOUS_USER, SYSTEM_PSWD, SYSTEM_USER
 
Constructor Summary
ExternalUserManager()
           
 
Method Summary
 User addGroup(User user, String groupName)
          Adds user to a group.
 User addRole(User user, String roleName)
          Grants user role.
 User changePassword(User user, String newPassword)
          Sets a new password.
 User createUser(String name, String pw)
          Creates a user without security restrictions.
 User createUser(String path, String name, String pw)
          Creates a user on given path.
 Map<String,ACL> getACLs(User user)
          Returns all ACLs assigned to the given user.
 Collection<User> getAllUsers()
          Get all users.
 User getAnonymousUser()
          SystemUserManager does this.
 int getLockTimePeriod()
          Gets a time period for account lock.
 int getMaxFailedLoginAttempts()
          Gets a number of failed attempts before locking account.
 User getSystemUser()
          SystemUserManager does this.
 User getUser(Map<String,String> properties, GroupList groupList, RoleList roleList)
           
 User getUser(String name)
          Find a specific user.
 User getUser(Subject subject)
          Initialize new user using JAAS authenticated/authorized subject.
 User getUserById(String id)
          Find a specific user.
 boolean hasAny(String name, String roleName, String nodeRoles)
          Checks whether principal belongs to the named resource.
 User removeGroup(User user, String groupName)
          Removes user from a group.
 User removeRole(User user, String roleName)
          Removes role from a user.
 void setLockTimePeriod(int lockTimePeriod)
          Sets a time period for account lock.
 void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
          Sets a number of failed attempts before locking account.
 User setProperty(User user, String propertyName, String propertyValue)
          Sets given property for the user and returns updated user object with new value of the property.
 User setProperty(User user, String propertyName, javax.jcr.Value propertyValue)
          Sets given property for the user and returns updated user object with new value of the property.
 void updateLastAccessTimestamp(User user)
          Updates last access timestamp for the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalUserManager

public ExternalUserManager()
Method Detail

getUser

public User getUser(String name)
             throws UnsupportedOperationException
Description copied from interface: UserManager
Find a specific user. Not all implementations will support this method.

Specified by:
getUser in interface UserManager
Parameters:
name - the name of the user
Returns:
the user object
Throws:
UnsupportedOperationException

getUserById

public User getUserById(String id)
                 throws UnsupportedOperationException
Description copied from interface: UserManager
Find a specific user. Not all implementations will support this method.

Specified by:
getUserById in interface UserManager
Parameters:
id - user identifier
Returns:
the user object
Throws:
UnsupportedOperationException

getUser

public User getUser(Subject subject)
             throws UnsupportedOperationException
Initialize new user using JAAS authenticated/authorized subject.

Specified by:
getUser in interface UserManager
Parameters:
subject -
Throws:
UnsupportedOperationException

getUser

public User getUser(Map<String,String> properties,
                    GroupList groupList,
                    RoleList roleList)

getAllUsers

public Collection<User> getAllUsers()
                             throws UnsupportedOperationException
Description copied from interface: UserManager
Get all users.

Specified by:
getAllUsers in interface UserManager
Returns:
collection of User objects
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

createUser

public User createUser(String name,
                       String pw)
                throws UnsupportedOperationException
Description copied from interface: UserManager
Creates a user without security restrictions.

Specified by:
createUser in interface UserManager
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

createUser

public User createUser(String path,
                       String name,
                       String pw)
                throws UnsupportedOperationException
Description copied from interface: UserManager
Creates a user on given path.

Specified by:
createUser in interface UserManager
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

changePassword

public User changePassword(User user,
                           String newPassword)
                    throws UnsupportedOperationException
Description copied from interface: UserManager
Sets a new password.

Specified by:
changePassword in interface UserManager
Returns:
user object with updated password.
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getSystemUser

public User getSystemUser()
                   throws UnsupportedOperationException
SystemUserManager does this.

Specified by:
getSystemUser in interface UserManager
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

getAnonymousUser

public User getAnonymousUser()
                      throws UnsupportedOperationException
SystemUserManager does this.

Specified by:
getAnonymousUser in interface UserManager
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

updateLastAccessTimestamp

public void updateLastAccessTimestamp(User user)
                               throws UnsupportedOperationException
Description copied from interface: UserManager
Updates last access timestamp for the user.

Specified by:
updateLastAccessTimestamp in interface UserManager
Throws:
UnsupportedOperationException - if the current implementation doesn't support this operation

hasAny

public boolean hasAny(String name,
                      String roleName,
                      String nodeRoles)
               throws UnsupportedOperationException
Description copied from interface: UserManager
Checks whether principal belongs to the named resource.

Specified by:
hasAny in interface UserManager
roleName - either group or role name
nodeRoles - either group or role see
Returns:
Throws:
UnsupportedOperationException

getACLs

public Map<String,ACL> getACLs(User user)
Description copied from interface: UserManager
Returns all ACLs assigned to the given user.

Specified by:
getACLs in interface UserManager
Returns:

addRole

public User addRole(User user,
                    String roleName)
Description copied from interface: UserManager
Grants user role.

Specified by:
addRole in interface UserManager
Returns:
user object with the role already granted.

addGroup

public User addGroup(User user,
                     String groupName)
Description copied from interface: UserManager
Adds user to a group.

Specified by:
addGroup in interface UserManager
Returns:
user object with the group already assigned.

getLockTimePeriod

public int getLockTimePeriod()
Description copied from interface: UserManager
Gets a time period for account lock.

Specified by:
getLockTimePeriod in interface UserManager

getMaxFailedLoginAttempts

public int getMaxFailedLoginAttempts()
Description copied from interface: UserManager
Gets a number of failed attempts before locking account.

Specified by:
getMaxFailedLoginAttempts in interface UserManager

setLockTimePeriod

public void setLockTimePeriod(int lockTimePeriod)
Description copied from interface: UserManager
Sets a time period for account lock.

Specified by:
setLockTimePeriod in interface UserManager

setMaxFailedLoginAttempts

public void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
Description copied from interface: UserManager
Sets a number of failed attempts before locking account.

Specified by:
setMaxFailedLoginAttempts in interface UserManager

setProperty

public User setProperty(User user,
                        String propertyName,
                        javax.jcr.Value propertyValue)
Description copied from interface: UserManager
Sets given property for the user and returns updated user object with new value of the property.

Specified by:
setProperty in interface UserManager
Parameters:
user - User to be updated. If property doesn't exist yet, it will be created. If the value is null, property will be removed if existing.
propertyName - Name of the property.
propertyValue - Value of the property. Use org.apache.jackrabbit.value.ValueFactoryImpl to convert type to Value.
Returns:

setProperty

public User setProperty(User user,
                        String propertyName,
                        String propertyValue)
Description copied from interface: UserManager
Sets given property for the user and returns updated user object with new value of the property.

Specified by:
setProperty in interface UserManager

removeGroup

public User removeGroup(User user,
                        String groupName)
Description copied from interface: UserManager
Removes user from a group.

Specified by:
removeGroup in interface UserManager
Returns:
user object with the group assignment removed.

removeRole

public User removeRole(User user,
                       String roleName)
Description copied from interface: UserManager
Removes role from a user.

Specified by:
removeRole in interface UserManager
Returns:
user object without removed role.


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.