public class MgnlUserManager extends RepositoryBackedSecurityManager implements UserManager
Modifier and Type | Field and Description |
---|---|
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_TIMEZONE |
static String |
PROPERTY_TITLE |
ANONYMOUS_USER, SYSTEM_PSWD, SYSTEM_USER
Constructor and Description |
---|
MgnlUserManager()
There should be no need to instantiate this class except maybe for testing.
|
Modifier and Type | Method and Description |
---|---|
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)
Deprecated.
since 5.3.2 use
createUserNode(String, String, javax.jcr.Session) instead |
protected javax.jcr.Node |
createUserNode(String path,
String userName,
javax.jcr.Session session) |
protected String |
encodePassword(String clearPassword) |
void |
findAllUsersInFolder(javax.jcr.Node node,
Collection<User> addTo)
Finds all users located in the provided node or in sub-folders within it and adds them to the given collection.
|
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()
Deprecated.
since 5.3.2 without replacement
|
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.
|
Collection<String> |
getUsersWithGroup(String groupName)
Returns all users which are the provided group.
|
Collection<String> |
getUsersWithGroup(String groupName,
boolean transitive)
Returns all users which are in the provided group.
|
Collection<String> |
getUsersWithRole(String roleName) |
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)
Deprecated.
since 5.2 use findAllUsersInFolder instead
|
protected void |
validateUsername(String name) |
add, findPrincipalNode, findPrincipalNode, findPrincipalNodes, findUsersOrGroupsHavingAssignedGroupOrRoleWithUid, getACLs, getACLs, getResourceName, hasAny, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasAny
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 PROPERTY_TIMEZONE
public static final String NODE_ACLUSERS
public MgnlUserManager()
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 retrievepublic User getUserById(String id)
getUserById
in interface UserManager
id
- user identifierpublic 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
@Deprecated public void updateUserListWithAllChildren(javax.jcr.Node node, Collection<User> users) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void findAllUsersInFolder(javax.jcr.Node node, Collection<User> addTo) 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)
insteadjavax.jcr.RepositoryException
protected void setPasswordProperty(javax.jcr.Node userNode, String clearPassword) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void validateUsername(String name)
protected Content createUserNode(String name) throws javax.jcr.RepositoryException
createUserNode(String, String, javax.jcr.Session)
insteadjavax.jcr.RepositoryException
protected javax.jcr.Node createUserNode(String path, String userName, javax.jcr.Session session) 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
public Collection<String> getUsersWithGroup(String groupName)
UserManager
getUsersWithGroup
in interface UserManager
groupName
- name of the grouppublic Collection<String> getUsersWithRole(String roleName)
getUsersWithRole
in interface UserManager
public Collection<String> getUsersWithGroup(String groupName, boolean transitive)
UserManager
getUsersWithGroup
in interface UserManager
groupName
- name of the grouptransitive
- whether the method should return also users which are in transitive groups of the given group.Copyright © 2003–2016 Magnolia International Ltd.. All rights reserved.