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 java.lang.Object
implements UserManager

Manages the users stored in Magnolia itself.

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

Field Summary
static java.lang.String NODE_ACLUSERS
           
static java.lang.String PROPERTY_EMAIL
           
static java.lang.String PROPERTY_LANGUAGE
           
static java.lang.String PROPERTY_LASTACCESS
           
static java.lang.String PROPERTY_PASSWORD
           
static java.lang.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, java.lang.String newPassword)
          Sets a new password.
 User createUser(java.lang.String name, java.lang.String pw)
          Creates a user without security restrictions.
protected  Content createUserNode(java.lang.String name)
           
protected  java.lang.String encodePassword(java.lang.String clearPassword)
           
protected  Content findUserNode(java.lang.String realm, java.lang.String name)
          Helper method to find a user in a certain realm.
 java.util.Collection<User> getAllUsers()
          Get all users managed by this user manager.
 User getAnonymousUser()
          SystemUserManager does this.
protected  User getFromRepository(java.lang.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.
 java.lang.String getName()
           
 java.lang.String getRealmName()
           
 User getSystemUser()
          SystemUserManager does this.
 User getUser(java.lang.String name)
          Get the user object.
 User getUser(javax.security.auth.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(java.lang.String name)
           
protected  void setPasswordProperty(Content userNode, java.lang.String clearPassword)
           
 void updateUserListWithAllChildren(Content node, java.util.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(java.lang.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 java.lang.String PROPERTY_EMAIL
See Also:
Constant Field Values

PROPERTY_LANGUAGE

public static final java.lang.String PROPERTY_LANGUAGE
See Also:
Constant Field Values

PROPERTY_LASTACCESS

public static final java.lang.String PROPERTY_LASTACCESS
See Also:
Constant Field Values

PROPERTY_PASSWORD

public static final java.lang.String PROPERTY_PASSWORD
See Also:
Constant Field Values

PROPERTY_TITLE

public static final java.lang.String PROPERTY_TITLE
See Also:
Constant Field Values

NODE_ACLUSERS

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

MgnlUserManager

public MgnlUserManager()
Do not instantiate it!

Method Detail

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getRealmName

public java.lang.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(java.lang.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(javax.security.auth.Subject subject)
             throws java.lang.UnsupportedOperationException
Description copied from interface: UserManager
Initialize new user using JAAS authenticated/authorized subject.

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

getFromRepository

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

findUserNode

protected Content findUserNode(java.lang.String realm,
                               java.lang.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 java.lang.UnsupportedOperationException
SystemUserManager does this.

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

getAnonymousUser

public User getAnonymousUser()
                      throws java.lang.UnsupportedOperationException
SystemUserManager does this.

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

getAllUsers

public java.util.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,
                                          java.util.Collection<User> users)
Updates collection with all users located under provided node.


createUser

public User createUser(java.lang.String name,
                       java.lang.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,
                           java.lang.String newPassword)
Description copied from interface: UserManager
Sets a new password.

Specified by:
changePassword in interface UserManager

setPasswordProperty

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

encodePassword

protected java.lang.String encodePassword(java.lang.String clearPassword)

validateUsername

protected void validateUsername(java.lang.String name)

createUserNode

protected Content createUserNode(java.lang.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-2011 Magnolia International Ltd.. All Rights Reserved.