|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.crowd.integration.directory.cache.CachingLDAPDirectory
public class CachingLDAPDirectory
| Constructor Summary | |
|---|---|
CachingLDAPDirectory(LDAPDirectory directory,
DirectoryCache directoryCache)
|
|
| Method Summary | ||
|---|---|---|
Group |
addGroup(GroupTemplate group)
Adds a group to the directory store. |
|
void |
addGroupToGroup(java.lang.String parentGroup,
java.lang.String childGroup)
Adds a group as a member of a parent group. |
|
User |
addUser(UserTemplate user,
PasswordCredential credential)
Adds a user to the directory store. |
|
void |
addUserToGroup(java.lang.String username,
java.lang.String groupName)
Adds a user as a member of a group. |
|
User |
authenticate(java.lang.String name,
PasswordCredential credential)
Authenticates a user with the directory store. |
|
protected java.util.List<LDAPGroupWithAttributes> |
findAllGroups()
|
|
protected java.util.List<LDAPGroupWithAttributes> |
findAllGroupsFromDirectory()
|
|
protected java.util.List<LDAPUserWithAttributes> |
findAllUsers()
|
|
protected java.util.List<LDAPUserWithAttributes> |
findAllUsersFromDirectory()
|
|
|
findEntityByDN(java.lang.String dn,
java.lang.Class<T> entityClass)
Finds a directory entity (principal, group or role) by their distinguished name. |
|
protected EntityIdentifier |
findEntityIdentifierFromDN(java.lang.String dn,
EntityType entityType)
|
|
Group |
findGroupByName(java.lang.String name)
Finds the group that matches the supplied name. |
|
Group |
findGroupByNameFromServerAndCacheResult(java.lang.String name)
|
|
protected java.util.List<LDAPGroupWithAttributes> |
findGroupMembershipsOfUser(java.lang.String username,
int startIndex,
int maxResults)
|
|
GroupWithAttributes |
findGroupWithAttributesByName(java.lang.String name)
Finds the group that matches the supplied name. |
|
User |
findUserByName(java.lang.String name)
Finds the user that matches the supplied name. |
|
UserWithAttributes |
findUserWithAttributesByName(java.lang.String name)
Finds the user that matches the supplied name. |
|
java.lang.String |
getAttribute(java.lang.String name)
|
|
java.util.Set<java.lang.String> |
getAttributeNames()
|
|
java.util.List<java.lang.String> |
getAttributes(java.lang.String name)
|
|
java.lang.String |
getDescriptiveName()
Returns a descriptive name for the type of directory. |
|
long |
getDirectoryId()
Gets the internal unique directoryId of the directory store. |
|
boolean |
hasAttribute(java.lang.String name)
|
|
protected boolean |
isFindAllEntities(EntityQuery query)
|
|
boolean |
isGroupDirectGroupMember(java.lang.String childGroup,
java.lang.String parentGroup)
Determines if a group is a direct member of another group. |
|
boolean |
isUserDirectGroupMember(java.lang.String userName,
java.lang.String groupName)
Determines if a user is a direct member of a group. |
|
void |
removeGroup(java.lang.String name)
Removes the group that matches the supplied name. |
|
void |
removeGroupAttributes(java.lang.String groupName,
java.lang.String attributeName)
Removes all the values for a single attribute key for a group. |
|
void |
removeGroupFromGroup(java.lang.String parentGroup,
java.lang.String childGroup)
Removes a group as a member of a parent group. |
|
void |
removeUser(java.lang.String name)
Removes the user that matches the supplied name. |
|
void |
removeUserAttributes(java.lang.String username,
java.lang.String attributeName)
Removes all the values for a single attribute key for a user. |
|
void |
removeUserFromGroup(java.lang.String username,
java.lang.String groupName)
Removes a user as a member of a group. |
|
Group |
renameGroup(java.lang.String oldName,
java.lang.String newName)
Renames a group. |
|
User |
renameUser(java.lang.String oldName,
java.lang.String newName)
Renames a user. |
|
java.util.List |
searchGroupRelationships(MembershipQuery query)
Searches for membership information. |
|
java.util.List |
searchGroups(EntityQuery query)
Searches for groups that match the supplied query criteria. |
|
java.util.List |
searchUsers(EntityQuery query)
Searches for users that match the supplied query criteria. |
|
void |
setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
When a directory store is loaded, the attributes map will be set by the Crowd framework. |
|
void |
setDirectoryId(long ID)
When a directory store is loaded, the directoryId will be set by the
crowd framework. |
|
void |
storeGroupAttributes(java.lang.String groupName,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> attributes)
Adds or updates a group's attributes with the new Map of attribute values in the directory specified by the passed in directoryId. |
|
void |
storeUserAttributes(java.lang.String username,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> attributes)
Adds or updates a user's attributes with the new Map of attribute values in the directory specified by the passed in directoryId. |
|
boolean |
supportsNestedGroups()
Allows us to only display nested-group related UI for directories that support it. |
|
void |
testConnection()
Test if a connection to the directory server can be established. |
|
Group |
updateGroup(GroupTemplate group)
Updates the group. |
|
User |
updateUser(UserTemplate user)
Updates the user. |
|
void |
updateUserCredential(java.lang.String name,
PasswordCredential credential)
Updates the password for a user. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachingLDAPDirectory(LDAPDirectory directory,
DirectoryCache directoryCache)
| Method Detail |
|---|
public long getDirectoryId()
RemoteDirectorydirectoryId of the directory store.
getDirectoryId in interface RemoteDirectorydirectoryId.public void setDirectoryId(long ID)
RemoteDirectorydirectoryId will be set by the
crowd framework.
setDirectoryId in interface RemoteDirectoryID - The unique directoryId of the Directory stored in the database.public java.lang.String getDescriptiveName()
RemoteDirectory
getDescriptiveName in interface RemoteDirectorypublic void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
RemoteDirectory
setAttributes in interface RemoteDirectoryattributes - attributes map.public java.lang.String getAttribute(java.lang.String name)
getAttribute in interface AttributeAwarename - attribute name.
null
if the attribute with the given name does not exist.
If multiple attribute values exist, any one could be
returned.public java.util.Set<java.lang.String> getAttributeNames()
getAttributeNames in interface AttributeAwarepublic java.util.List<java.lang.String> getAttributes(java.lang.String name)
getAttributes in interface AttributeAwarename - attribute name.
public boolean hasAttribute(java.lang.String name)
hasAttribute in interface AttributeAwarename - attribute name.
true if an only if the
user has an attribute with the supplied name
and has one or more values.
public void testConnection()
throws DirectoryAccessException
RemoteDirectory
testConnection in interface RemoteDirectoryDirectoryAccessException - An unknown wire exception occurred.
public User authenticate(java.lang.String name,
PasswordCredential credential)
throws InactiveAccountException,
InvalidAuthenticationException,
ObjectNotFoundException
RemoteDirectoryuser with the directory store.
authenticate in interface RemoteDirectoryname - The name of the user (username).credential - The supplied credentials (password).
InactiveAccountException - The supplied user is inactive.
InvalidAuthenticationException - Authentication with the provided credentials failed.
ObjectNotFoundException - The user wth the supplied name does not exist.public boolean supportsNestedGroups()
RemoteDirectory
supportsNestedGroups in interface RemoteDirectory
public void updateUserCredential(java.lang.String name,
PasswordCredential credential)
throws ObjectNotFoundException,
InvalidCredentialException
RemoteDirectorypassword for a user.
updateUserCredential in interface RemoteDirectoryname - The name of the user (username).credential - The new credential (password).
ObjectNotFoundException - The user does not exist.
InvalidCredentialException - The supplied credential is invalid.
public User renameUser(java.lang.String oldName,
java.lang.String newName)
throws ObjectNotFoundException,
InvalidUserException
RemoteDirectoryuser.
renameUser in interface RemoteDirectoryoldName - name of existing user.newName - desired name of user.
ObjectNotFoundException - if the user with the existing name does not exist.
InvalidUserException - if the new username is invalid or already exists in the directory.
public void storeUserAttributes(java.lang.String username,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> attributes)
throws ObjectNotFoundException
RemoteDirectorydirectoryId.
The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute
matches the key of an existing
storeUserAttributes in interface RemoteDirectoryusername - name of user to update.attributes - new or updated attributes (attributes that don't need changing should not appear in this Map).
ObjectNotFoundException - user with supplied username does not exist.
public void removeUserAttributes(java.lang.String username,
java.lang.String attributeName)
throws ObjectNotFoundException
RemoteDirectory
removeUserAttributes in interface RemoteDirectoryusername - name of the user to update.attributeName - name of attribute to remove.
ObjectNotFoundException - user with supplied username does not exist.
public User findUserByName(java.lang.String name)
throws ObjectNotFoundException
RemoteDirectoryuser that matches the supplied name.
findUserByName in interface RemoteDirectoryname - the name of the user (username).
ObjectNotFoundException - a user with the supplied name does not exist.
public UserWithAttributes findUserWithAttributesByName(java.lang.String name)
throws ObjectNotFoundException
RemoteDirectoryuser that matches the supplied name.
findUserWithAttributesByName in interface RemoteDirectoryname - the name of the user (username).
ObjectNotFoundException - a user with the supplied name does not exist.
public Group findGroupByName(java.lang.String name)
throws ObjectNotFoundException
RemoteDirectorygroup that matches the supplied name.
findGroupByName in interface RemoteDirectoryname - the name of the group.
ObjectNotFoundException - a group with the supplied name does not exist.
public GroupWithAttributes findGroupWithAttributesByName(java.lang.String name)
throws ObjectNotFoundException
RemoteDirectorygroup that matches the supplied name.
findGroupWithAttributesByName in interface RemoteDirectoryname - the name of the group.
ObjectNotFoundException - a group with the supplied name does not exist.
public Group findGroupByNameFromServerAndCacheResult(java.lang.String name)
throws ObjectNotFoundException
ObjectNotFoundException
public <T extends LDAPDirectoryEntity> T findEntityByDN(java.lang.String dn,
java.lang.Class<T> entityClass)
throws ObjectNotFoundException
LDAPDirectory
findEntityByDN in interface LDAPDirectorydn - standardised disinguished name.entityClass - class of the entity to find (either LDAPUserWithAttributes or LDAPGroupWithAttributes).
ObjectNotFoundException - if a user/group
does not exist at the specified DN or the DN does not
exist in the directory. This will also be thrown if
the entity DOES exist but does not match the base DN
or object filter for the entity type.
protected EntityIdentifier findEntityIdentifierFromDN(java.lang.String dn,
EntityType entityType)
throws ObjectNotFoundException
ObjectNotFoundException
public boolean isGroupDirectGroupMember(java.lang.String childGroup,
java.lang.String parentGroup)
RemoteDirectory
isGroupDirectGroupMember in interface RemoteDirectorychildGroup - name of child group.parentGroup - name of parent group.
true iff the childGroup is a direct member of the parentGroup.
public boolean isUserDirectGroupMember(java.lang.String userName,
java.lang.String groupName)
RemoteDirectory
isUserDirectGroupMember in interface RemoteDirectoryuserName - name of user.groupName - name of group.
true iff the user is a direct member of the group.
public void addUserToGroup(java.lang.String username,
java.lang.String groupName)
throws ObjectNotFoundException
RemoteDirectorychildGroup will
appear as members of parentGroup to querying applications.
addUserToGroup in interface RemoteDirectoryusername - The user that will become a member of groupNamegroupName - The group that will gain a new member.
ObjectNotFoundException - If the user or group cannot be found.
public void addGroupToGroup(java.lang.String parentGroup,
java.lang.String childGroup)
throws ObjectNotFoundException,
java.lang.UnsupportedOperationException,
InvalidMembershipException
RemoteDirectory
addGroupToGroup in interface RemoteDirectoryparentGroup - The group that will become a member of parentGroupchildGroup - The group that will gain a new member
ObjectNotFoundException - One or both of the groups cannot be found.
InvalidMembershipException - if the childGroup and parentGroup exist but are of different GroupTypes.
java.lang.UnsupportedOperationException
public void removeUserFromGroup(java.lang.String username,
java.lang.String groupName)
throws ObjectNotFoundException,
MembershipNotFoundException
RemoteDirectory
removeUserFromGroup in interface RemoteDirectoryusername - The user that will be removed from parentGroupgroupName - The group that will lose the member.
ObjectNotFoundException - If either the user or group cannot be found.
MembershipNotFoundException - if the user is not a direct member of the group.
public void removeGroupFromGroup(java.lang.String parentGroup,
java.lang.String childGroup)
throws ObjectNotFoundException,
java.lang.UnsupportedOperationException,
InvalidMembershipException,
MembershipNotFoundException
RemoteDirectory
removeGroupFromGroup in interface RemoteDirectoryparentGroup - The group that will be removed from parentGroupchildGroup - The group that will lose the member.
ObjectNotFoundException - One or both of the groups cannot be found.
InvalidMembershipException - if the childGroup and parentGroup exist but are of different GroupTypes.
MembershipNotFoundException - if the childGroup is not a direct member of the parentGroup.
java.lang.UnsupportedOperationException
public User addUser(UserTemplate user,
PasswordCredential credential)
throws InvalidUserException,
ObjectNotFoundException,
InvalidCredentialException
RemoteDirectoryuser to the directory store.
addUser in interface RemoteDirectoryuser - template of the user to add.credential - password. May be null, since JIRA creates a user in two steps (user THEN password)
InvalidUserException - The supplied user is invalid.
ObjectNotFoundException - The user could not be looked up after creation or the directory with the ID of user.directoryId does not exist.
InvalidCredentialException - The supplied credential is invalid.
public User updateUser(UserTemplate user)
throws ObjectNotFoundException,
InvalidUserException
RemoteDirectoryuser.
updateUser in interface RemoteDirectoryuser - The user to update.
ObjectNotFoundException - the user does not exist in the directory store.
InvalidUserException - the supplied user is invalid.
public Group addGroup(GroupTemplate group)
throws InvalidGroupException,
ObjectNotFoundException
RemoteDirectorygroup to the directory store.
addGroup in interface RemoteDirectorygroup - template of the group to add.
InvalidGroupException - The supplied group is invalid.
ObjectNotFoundException - The group could not be looked up after creation or the directory with the ID of group.directoryId does not exist.
public Group updateGroup(GroupTemplate group)
throws ObjectNotFoundException,
InvalidGroupException
RemoteDirectorygroup.
updateGroup in interface RemoteDirectorygroup - The group to update.
ObjectNotFoundException - the group does not exist in the directory store.
InvalidGroupException - the supplied group is invalid.
public Group renameGroup(java.lang.String oldName,
java.lang.String newName)
throws ObjectNotFoundException,
InvalidGroupException
RemoteDirectorygroup.
renameGroup in interface RemoteDirectoryoldName - name of existing group.newName - desired name of group.
ObjectNotFoundException - if the group with the existing name does not exist.
InvalidGroupException - if the new groupname is invalid or already exists in the directory.
public void storeGroupAttributes(java.lang.String groupName,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> attributes)
throws ObjectNotFoundException
RemoteDirectorydirectoryId.
The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute
matches the key of an existing
storeGroupAttributes in interface RemoteDirectorygroupName - name of group to update.attributes - new or updated attributes (attributes that don't need changing should not appear in this Map).
ObjectNotFoundException - group with supplied groupName does not exist.
public void removeGroupAttributes(java.lang.String groupName,
java.lang.String attributeName)
throws ObjectNotFoundException
RemoteDirectory
removeGroupAttributes in interface RemoteDirectorygroupName - name of the group to update.attributeName - name of attribute to remove.
ObjectNotFoundException - group with supplied groupName does not exist.
public void removeUser(java.lang.String name)
throws ObjectNotFoundException
RemoteDirectoryuser that matches the supplied name.
removeUser in interface RemoteDirectoryname - The name of the user (username).
ObjectNotFoundException - The user does not exist.
public void removeGroup(java.lang.String name)
throws ObjectNotFoundException
RemoteDirectorygroup that matches the supplied name.
removeGroup in interface RemoteDirectoryname - The name of the group.
ObjectNotFoundException - The group does not exist.public java.util.List searchGroupRelationships(MembershipQuery query)
RemoteDirectory
searchGroupRelationships in interface RemoteDirectoryquery - query for memberships.
protected java.util.List<LDAPGroupWithAttributes> findGroupMembershipsOfUser(java.lang.String username,
int startIndex,
int maxResults)
throws ObjectNotFoundException
ObjectNotFoundExceptionprotected boolean isFindAllEntities(EntityQuery query)
protected java.util.List<LDAPUserWithAttributes> findAllUsersFromDirectory()
protected java.util.List<LDAPGroupWithAttributes> findAllGroupsFromDirectory()
protected java.util.List<LDAPUserWithAttributes> findAllUsers()
protected java.util.List<LDAPGroupWithAttributes> findAllGroups()
public java.util.List searchGroups(EntityQuery query)
RemoteDirectorygroups that match the supplied query criteria.
searchGroups in interface RemoteDirectoryquery - EntityQuery for Entity.GROUP.
List or List of groups/groupnames
matching the search criteria. An empty List will be returned
if no groups matching the criteria are found.public java.util.List searchUsers(EntityQuery query)
RemoteDirectoryusers that match the supplied query criteria.
searchUsers in interface RemoteDirectoryquery - EntityQuery for Entity.USER.
List<User> or List<String> of users/usernames
matching the search criteria. An empty List will be returned
if no users matching the criteria are found.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||