|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.security.RepositoryBackedSecurityManager info.magnolia.cms.security.MgnlUserManager
public class MgnlUserManager
Manages the users stored in Magnolia itself.
Field Summary | |
---|---|
static String |
NODE_ACLUSERS
|
static String |
PROPERTY_EMAIL
|
static String |
PROPERTY_ENABLED
|
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()
There should be no need to instantiate this class except maybe for testing. |
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. |
protected Content |
createUserNode(String name)
|
protected String |
encodePassword(String clearPassword)
|
protected javax.jcr.Node |
findPrincipalNode(String name,
javax.jcr.Session session)
Helper method to find a user in a certain realm. |
protected Content |
findUserNode(String realm,
String name)
Deprecated. since 4.5 use findPrincipalNode(java.lang.String, javax.jcr.Session) instead |
Map<String,ACL> |
getACLs(User user)
Sets access control list from a list of roles under the provided content object. |
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). |
int |
getLockTimePeriod()
Gets a time period for account lock. |
int |
getMaxFailedLoginAttempts()
Gets a number of failed attempts before locking account. |
String |
getName()
Deprecated. since 4.5 use realmName instead |
String |
getRealmName()
|
protected String |
getRepositoryName()
|
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. |
User |
getUserById(String id)
Get the user object. |
boolean |
isAllowCrossRealmDuplicateNames()
|
protected User |
newUserInstance(Content node)
Deprecated. since 4.5 use newUSerInstance(javax.jcr.Node) instead |
protected User |
newUserInstance(javax.jcr.Node privilegedUserNode)
|
User |
removeGroup(User user,
String groupName)
Removes user from a group. |
User |
removeRole(User user,
String roleName)
Removes role from a user. |
void |
setAllowCrossRealmDuplicateNames(boolean allowCrossRealmDuplicateNames)
|
void |
setLockTimePeriod(int lockTimePeriod)
Sets a time period for account lock. |
void |
setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
Sets a number of failed attempts before locking account. |
void |
setName(String name)
Deprecated. since 4.5 use realmName instead |
protected void |
setPasswordProperty(Content userNode,
String clearPassword)
Deprecated. since 4.5 use setPasswordProperty(Node, String) instead |
protected void |
setPasswordProperty(javax.jcr.Node userNode,
String clearPassword)
|
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. |
void |
setRealmName(String name)
|
void |
updateLastAccessTimestamp(User user)
Updates last access timestamp for the user. |
void |
updateUserListWithAllChildren(javax.jcr.Node node,
Collection<User> users)
Updates collection with all users located under provided node. |
protected void |
validateUsername(String name)
|
Methods inherited from class info.magnolia.cms.security.RepositoryBackedSecurityManager |
---|
add, getACLs, getACLs, getResourceName, hasAny, remove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface info.magnolia.cms.security.UserManager |
---|
hasAny |
Field Detail |
---|
public static final String PROPERTY_EMAIL
public static final String PROPERTY_LANGUAGE
public static final String PROPERTY_LASTACCESS
public static final String PROPERTY_PASSWORD
public static final String PROPERTY_TITLE
public static final String PROPERTY_ENABLED
public static final String NODE_ACLUSERS
Constructor Detail |
---|
public MgnlUserManager()
Method Detail |
---|
public void setMaxFailedLoginAttempts(int maxFailedLoginAttempts)
UserManager
setMaxFailedLoginAttempts
in interface UserManager
public int getMaxFailedLoginAttempts()
UserManager
getMaxFailedLoginAttempts
in interface UserManager
public int getLockTimePeriod()
UserManager
getLockTimePeriod
in interface UserManager
public void setLockTimePeriod(int lockTimePeriod)
UserManager
setLockTimePeriod
in interface UserManager
public User setProperty(User user, String propertyName, javax.jcr.Value propertyValue)
UserManager
setProperty
in interface UserManager
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.
public User setProperty(User user, String propertyName, String propertyValue)
UserManager
setProperty
in interface UserManager
@Deprecated public String getName()
@Deprecated public void setName(String name)
public void setRealmName(String name)
public String getRealmName()
public void setAllowCrossRealmDuplicateNames(boolean allowCrossRealmDuplicateNames)
public boolean isAllowCrossRealmDuplicateNames()
public User getUser(String name)
getUser
in interface UserManager
name
- name of the user to retrieve
public User getUserById(String id)
getUserById
in interface UserManager
id
- user identifier
public User getUser(Subject subject) throws UnsupportedOperationException
UserManager
getUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operation@Deprecated protected Content findUserNode(String realm, String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected javax.jcr.Node findPrincipalNode(String name, javax.jcr.Session session) throws javax.jcr.RepositoryException
findPrincipalNode
in class RepositoryBackedSecurityManager
javax.jcr.RepositoryException
protected User getFromRepository(String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public User getSystemUser() throws UnsupportedOperationException
getSystemUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationpublic User getAnonymousUser() throws UnsupportedOperationException
getAnonymousUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationpublic Collection<User> getAllUsers()
getAllUsers
in interface UserManager
public void updateUserListWithAllChildren(javax.jcr.Node node, Collection<User> users) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public User createUser(String name, String pw)
UserManager
createUser
in interface UserManager
public User createUser(String path, String name, String pw) throws UnsupportedOperationException
UserManager
createUser
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationpublic User changePassword(User user, String newPassword)
UserManager
changePassword
in interface UserManager
@Deprecated protected void setPasswordProperty(Content userNode, String clearPassword) throws javax.jcr.RepositoryException
setPasswordProperty(Node, String)
instead
javax.jcr.RepositoryException
protected void setPasswordProperty(javax.jcr.Node userNode, String clearPassword) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected String encodePassword(String clearPassword)
protected void validateUsername(String name)
protected Content createUserNode(String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected HierarchyManager getHierarchyManager()
@Deprecated protected User newUserInstance(Content node)
MgnlUser
out of a jcr node. Can be overridden in order to provide a different implementation.
public void updateLastAccessTimestamp(User user) throws UnsupportedOperationException
UserManager
updateLastAccessTimestamp
in interface UserManager
UnsupportedOperationException
- if the current implementation doesn't support this operationprotected User newUserInstance(javax.jcr.Node privilegedUserNode) throws javax.jcr.ValueFormatException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
javax.jcr.ValueFormatException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
protected String getRepositoryName()
getRepositoryName
in class RepositoryBackedSecurityManager
public Map<String,ACL> getACLs(User user)
getACLs
in interface UserManager
public User addRole(User user, String roleName)
UserManager
addRole
in interface UserManager
public User addGroup(User user, String groupName)
UserManager
addGroup
in interface UserManager
public User removeGroup(User user, String groupName)
UserManager
removeGroup
in interface UserManager
public User removeRole(User user, String roleName)
UserManager
removeRole
in interface UserManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |