info.magnolia.cms.security
Class MgnlUserManager

java.lang.Object
  extended by info.magnolia.cms.security.MgnlUserManager
All Implemented Interfaces:
UserManager
Direct Known Subclasses:
HierarchicalUserManager, SystemUserManager

public class MgnlUserManager
extends Object
implements UserManager

Manages the users stored in Magnolia itself.

Version:
$Revision: 48411 $ ($Author: ochytil $)

Field Summary
static String NODE_ACLUSERS
           
static String PROPERTY_EMAIL
           
static String PROPERTY_LANGUAGE
           
static String PROPERTY_LASTACCESS
           
static String PROPERTY_PASSWORD
           
static String PROPERTY_TITLE
           
 
Fields inherited from interface info.magnolia.cms.security.UserManager
ANONYMOUS_USER, SYSTEM_PSWD, SYSTEM_USER
 
Constructor Summary
MgnlUserManager()
          Do not instantiate it!
 
Method Summary
 void changePassword(User user, String newPassword)
          Sets a new password.
 User createUser(String name, String pw)
          Creates a user without security restrictions.
protected  Content createUserNode(String name)
           
protected  String encodePassword(String clearPassword)
           
protected  Content findUserNode(String realm, String name)
          Helper method to find a user in a certain realm.
 Collection<User> getAllUsers()
          Get all users managed by this user manager.
 User getAnonymousUser()
          SystemUserManager does this.
protected  User getFromRepository(String name)
           
protected  HierarchyManager getHierarchyManager()
          Return the HierarchyManager for the user workspace (through the system context).
 long getLockTimePeriod()
          Gets a time in minutes for which account will be locked out in case of reaching maximum count of failed login attempts.
 int getMaxFailedLoginAttempts()
          Gets a number of failed attempts before locking account.
 String getName()
           
 String getRealmName()
           
 User getSystemUser()
          SystemUserManager does this.
 User getUser(String name)
          Get the user object.
 User getUser(Subject subject)
          Initialize new user using JAAS authenticated/authorized subject.
protected  User newUserInstance(Content node)
          Creates a MgnlUser out of a jcr node.
 void setLockTimePeriod(long lockTimePeriod)
          Sets a time in minutes for which account will be locked out in case of reaching maximum count of failed login attempts.
 void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
          Sets a number of failed attempts before locking account.
 void setName(String name)
           
protected  void setPasswordProperty(Content userNode, String clearPassword)
           
 void updateUserListWithAllChildren(Content node, Collection<User> users)
          Updates collection with all users located under provided node.
protected  MgnlUser userInstance(Content node)
          Deprecated. since 4.3.1 - use newUserInstance(info.magnolia.cms.core.Content)
protected  void validateUsername(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_EMAIL

public static final String PROPERTY_EMAIL
See Also:
Constant Field Values

PROPERTY_LANGUAGE

public static final String PROPERTY_LANGUAGE
See Also:
Constant Field Values

PROPERTY_LASTACCESS

public static final String PROPERTY_LASTACCESS
See Also:
Constant Field Values

PROPERTY_PASSWORD

public static final String PROPERTY_PASSWORD
See Also:
Constant Field Values

PROPERTY_TITLE

public static final String PROPERTY_TITLE
See Also:
Constant Field Values

NODE_ACLUSERS

public static final String NODE_ACLUSERS
See Also:
Constant Field Values
Constructor Detail

MgnlUserManager

public MgnlUserManager()
Do not instantiate it!

Method Detail

getName

public String getName()

setName

public void setName(String name)

getRealmName

public String getRealmName()

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

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(long lockTimePeriod)
Description copied from interface: UserManager
Sets a time in minutes for which account will be locked out in case of reaching maximum count of failed login attempts.

Specified by:
setLockTimePeriod in interface UserManager

getLockTimePeriod

public long getLockTimePeriod()
Description copied from interface: UserManager
Gets a time in minutes for which account will be locked out in case of reaching maximum count of failed login attempts.

Specified by:
getLockTimePeriod in interface UserManager

getUser

public User getUser(String name)
Get the user object. Uses a search

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

getUser

public User getUser(Subject subject)
             throws UnsupportedOperationException
Description copied from interface: UserManager
Initialize new user using JAAS authenticated/authorized subject.

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

getFromRepository

protected User getFromRepository(String name)
                          throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

findUserNode

protected Content findUserNode(String realm,
                               String name)
                        throws javax.jcr.RepositoryException
Helper method to find a user in a certain realm. Uses JCR Query.

Throws:
javax.jcr.RepositoryException

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

getAllUsers

public Collection<User> getAllUsers()
Get all users managed by this user manager.

Specified by:
getAllUsers in interface UserManager
Returns:
collection of User objects

updateUserListWithAllChildren

public void updateUserListWithAllChildren(Content node,
                                          Collection<User> users)
Updates collection with all users located under provided node.


createUser

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

Specified by:
createUser in interface UserManager

changePassword

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

Specified by:
changePassword in interface UserManager

setPasswordProperty

protected void setPasswordProperty(Content userNode,
                                   String clearPassword)
                            throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

encodePassword

protected String encodePassword(String clearPassword)

validateUsername

protected void validateUsername(String name)

createUserNode

protected Content createUserNode(String name)
                          throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getHierarchyManager

protected HierarchyManager getHierarchyManager()
Return the HierarchyManager for the user workspace (through the system context).


userInstance

protected MgnlUser userInstance(Content node)
Deprecated. since 4.3.1 - use newUserInstance(info.magnolia.cms.core.Content)


newUserInstance

protected User newUserInstance(Content node)
Creates a MgnlUser out of a jcr node. Can be overridden in order to provide a different implementation.

Since:
4.3.1


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