Package com.atlassian.crowd.directory
Class Rfc2307
java.lang.Object
com.atlassian.crowd.directory.SpringLDAPConnector
com.atlassian.crowd.directory.RFC2307Directory
com.atlassian.crowd.directory.Rfc2307
- All Implemented Interfaces:
LDAPDirectory,RemoteDirectory,Attributes
- Direct Known Subclasses:
AppleOpenDirectory,FedoraDS,OpenLDAPRfc2307
This class provides read-only support for the POSIX LDAP Schema (RFC2307)
-
Field Summary
Fields inherited from class com.atlassian.crowd.directory.SpringLDAPConnector
attributes, contextSource, contextSourceTransactionManager, DEFAULT_PAGE_SIZE, eventPublisher, ldapPropertiesMapper, ldapQueryTranslater, ldapTemplate, nameConverter, searchDN -
Constructor Summary
ConstructorsConstructorDescriptionRfc2307(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory, PasswordEncoderFactory passwordEncoderFactory, LdapContextSourceProvider ldapContextSourceProvider) -
Method Summary
Modifier and TypeMethodDescriptionaddGroup(GroupTemplate group) Adds agroupto the directory store.voidaddGroupToGroup(String childGroup, String parentGroup) Adds a group as a member of a parent group.addUser(UserTemplate user, PasswordCredential credential) Adds a user to LDAP.addUser(UserTemplateWithAttributes user, PasswordCredential credential) Adds a user to LDAP.voidaddUserToGroup(String username, String groupName) Adds a user as a member of a group.protected LDAPCredentialEncoderReturns a descriptive name for the type of directory.protected voidgetNewUserDirectorySpecificAttributes(User user, Attributes attributes) Populates attributes object with directory-specific attributes.static StringvoidremoveGroup(String name) Removes thegroupthat matches the suppliedname.voidremoveGroupFromGroup(String childGroup, String parentGroup) Removes a group as a member of a parent group.voidremoveUser(String name) Removes theuserthat matches the suppliedname.voidremoveUserFromGroup(String username, String groupName) Removes a user as a member of a group.renameGroup(String oldName, String newName) Renames agroup.renameUser(String oldName, String newName) Renames auser.updateGroup(GroupTemplate group) Updates thegroup.updateUser(UserTemplate user) Updates theuser.Methods inherited from class com.atlassian.crowd.directory.RFC2307Directory
getCustomGroupAttributeMappers, getCustomUserAttributeMappers, getMemberOnlyGroupAttributeMappers, getMemberships, isGroupDirectGroupMember, isUserDirectGroupMember, searchGroupRelationshipsWithGroupTypeSpecified, supportsNestedGroups, supportsPasswordExpirationMethods inherited from class com.atlassian.crowd.directory.SpringLDAPConnector
addDefaultSnToUserAttributes, addDefaultValueToUserAttributesForAttribute, authenticate, avatarMapper, countDirectMembersOfGroup, createModificationItem, expireAllPasswords, findEntityByDN, findEntityByDN, findEntityByDN, findGroupByName, findGroupByNameAndType, findGroupWithAttributesByName, findUserByExternalId, findUserByName, findUserWithAttributesByName, getAttributeAsBoolean, getAttributeAsLong, getAuthoritativeDirectory, getBaseEnvironmentProperties, getContextSource, getDirectoryId, getGroupContextMapper, getGroupContextMapper, getInitialGroupMemberDN, getKeys, getLdapPropertiesMapper, getNewGroupAttributes, getNewGroupDirectorySpecificAttributes, getNewUserAttributes, getRequiredCustomGroupAttributeMappers, getSearchControls, getSearchDN, getUserAvatarByName, getUserModificationItems, getValue, getValues, isEmpty, isRolesDisabled, pageSearchResults, postprocessGroup, postprocessGroups, removeGroupAttributes, removeUserAttributes, searchEntities, searchEntitiesWithRequestControls, searchGroupObjects, searchGroupObjectsOfSpecifiedGroupType, searchGroupRelationships, searchGroups, searchUserObjects, searchUsers, searchUsers, setAttributes, setDirectoryId, setLdapPropertiesMapperAttributes, storeGroupAttributes, storeUserAttributes, supportsInactiveAccounts, supportsSettingEncryptedCredential, testConnection, typedEntityNotFoundException, updateUserCredentialMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.crowd.directory.RemoteDirectory
authenticate, getLocallyFilteredGroupNames, updateUserFromRemoteDirectory, userAuthenticated
-
Constructor Details
-
Rfc2307
public Rfc2307(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory, PasswordEncoderFactory passwordEncoderFactory, LdapContextSourceProvider ldapContextSourceProvider)
-
-
Method Details
-
getStaticDirectoryType
-
getCredentialEncoder
- Specified by:
getCredentialEncoderin classSpringLDAPConnector- Returns:
- the credential encoder to use with this directory; must not be null.
-
getNewUserDirectorySpecificAttributes
Description copied from class:SpringLDAPConnectorPopulates attributes object with directory-specific attributes.Overrider of this method can take advantage of the default group attributes mapping logic in {#getNewUserAttributes(User)}.
Note that the attribute values supplied here will be used raw. This entails that overrider is responsible for supplying values in a format supported by the directory. In some directory implementations, for example, a blank string ("") is considered illegal. Overrider thus would have to make sure the method does not generate a value as such.
- Overrides:
getNewUserDirectorySpecificAttributesin classSpringLDAPConnector- Parameters:
user- (potential) source of information that needs to be added.attributes- attributes to add directory-specific information to.
-
getDescriptiveName
Description copied from interface:RemoteDirectoryReturns a descriptive name for the type of directory.- Returns:
- descriptive name.
-
addUserToGroup
public void addUserToGroup(String username, String groupName) throws UserNotFoundException, GroupNotFoundException, OperationFailedException Description copied from interface:RemoteDirectoryAdds a user as a member of a group. This means that all user members ofchildGroupwill appear as members ofparentGroupto querying applications.- Parameters:
username- The user that will become a member ofgroupNamegroupName- The group that will gain a new member.- Throws:
UserNotFoundException- If the user cannot be found.GroupNotFoundException- If the group cannot be found.OperationFailedException- underlying directory implementation failed to execute the operation.
-
addGroupToGroup
public void addGroupToGroup(String childGroup, String parentGroup) throws GroupNotFoundException, OperationFailedException Description copied from interface:RemoteDirectoryAdds a group as a member of a parent group.- Parameters:
childGroup- The group that will become a member ofparentGroupparentGroup- The group that will gain a new member- Throws:
GroupNotFoundException- One or both of the groups cannot be found.OperationFailedException- underlying directory implementation failed to execute the operation.
-
removeUserFromGroup
public void removeUserFromGroup(String username, String groupName) throws UserNotFoundException, GroupNotFoundException, MembershipNotFoundException, OperationFailedException Description copied from interface:RemoteDirectoryRemoves a user as a member of a group.- Parameters:
username- The user that will be removed fromparentGroupgroupName- The group that will lose the member.- Throws:
UserNotFoundException- If the user cannot be found.GroupNotFoundException- If the group cannot be found.MembershipNotFoundException- if the user is not a direct member of the group.OperationFailedException- underlying directory implementation failed to execute the operation.
-
removeGroupFromGroup
public void removeGroupFromGroup(String childGroup, String parentGroup) throws GroupNotFoundException, MembershipNotFoundException, OperationFailedException Description copied from interface:RemoteDirectoryRemoves a group as a member of a parent group.- Parameters:
childGroup- The group that will be removed fromparentGroupparentGroup- The group that will lose the member.- Throws:
GroupNotFoundException- One or both of the groups cannot be found.MembershipNotFoundException- if the childGroup is not a direct member of the parentGroup.OperationFailedException- underlying directory implementation failed to execute the operation.
-
addUser
public LDAPUserWithAttributes addUser(UserTemplate user, PasswordCredential credential) throws InvalidUserException, InvalidCredentialException, OperationFailedException Description copied from class:SpringLDAPConnectorAdds a user to LDAP.- Specified by:
addUserin interfaceRemoteDirectory- Overrides:
addUserin classSpringLDAPConnector- Parameters:
user- template of the user to add.credential- password.- Returns:
- LDAP user retrieved from LDAP after successfully adding the user to LDAP.
- Throws:
InvalidUserException- if the user to create was deemed invalid by the LDAP server or already exists.InvalidCredentialException- if the password credential was deemed invalid by the password encoder.OperationFailedException- if we were unable to add the user to LDAP.- See Also:
-
addUser
public LDAPUserWithAttributes addUser(UserTemplateWithAttributes user, PasswordCredential credential) throws InvalidUserException, InvalidCredentialException, OperationFailedException Description copied from class:SpringLDAPConnectorAdds a user to LDAP.- Specified by:
addUserin interfaceRemoteDirectory- Overrides:
addUserin classSpringLDAPConnector- Parameters:
user- template of the user to add.credential- password.- Returns:
- LDAP user retrieved from LDAP after successfully adding the user to LDAP.
- Throws:
InvalidUserException- if the user to create was deemed invalid by the LDAP server or already exists.InvalidCredentialException- if the password credential was deemed invalid by the password encoder.OperationFailedException- if we were unable to add the user to LDAP.- See Also:
-
addGroup
Description copied from interface:RemoteDirectoryAdds agroupto the directory store.- Specified by:
addGroupin interfaceRemoteDirectory- Overrides:
addGroupin classSpringLDAPConnector- Parameters:
group- template of the group to add.- Returns:
- the added group retrieved from the underlying store.
- Throws:
InvalidGroupException- The supplied group is invalid or it already exists in the directory.OperationFailedException- underlying directory implementation failed to execute the operation.
-
renameGroup
public Group renameGroup(String oldName, String newName) throws GroupNotFoundException, InvalidGroupException, OperationFailedException Description copied from interface:RemoteDirectoryRenames agroup.- Specified by:
renameGroupin interfaceRemoteDirectory- Overrides:
renameGroupin classSpringLDAPConnector- Parameters:
oldName- name of existing group.newName- desired name of group.- Returns:
- renamed group.
- Throws:
GroupNotFoundException- if the group with the existing name does not exist.InvalidGroupException- if the new group name is invalid or already exists in the directory.OperationFailedException- if the underlying directory implementation failed to execute the operation.
-
renameUser
public User renameUser(String oldName, String newName) throws UserNotFoundException, InvalidUserException, OperationFailedException Description copied from interface:RemoteDirectoryRenames auser.- Specified by:
renameUserin interfaceRemoteDirectory- Overrides:
renameUserin classSpringLDAPConnector- Parameters:
oldName- name of existing user.newName- desired name of user.- Returns:
- renamed user.
- Throws:
UserNotFoundException- if the user with the existing name does not exist.InvalidUserException- if the new username is invalid.OperationFailedException- if the underlying directory implementation failed to execute the operation.
-
updateGroup
public Group updateGroup(GroupTemplate group) throws GroupNotFoundException, OperationFailedException Description copied from interface:RemoteDirectoryUpdates thegroup.- Specified by:
updateGroupin interfaceRemoteDirectory- Overrides:
updateGroupin classSpringLDAPConnector- Parameters:
group- The group to update.- Returns:
- the updated group retrieved from the underlying store.
- Throws:
GroupNotFoundException- the group does not exist in the directory store.OperationFailedException- underlying directory implementation failed to execute the operation.
-
updateUser
Description copied from interface:RemoteDirectoryUpdates theuser.- Specified by:
updateUserin interfaceRemoteDirectory- Overrides:
updateUserin classSpringLDAPConnector- Parameters:
user- The user to update.- Returns:
- the updated user retrieved from the underlying store.
- Throws:
UserNotFoundException- the user does not exist in the directory store.OperationFailedException- underlying directory implementation failed to execute the operation.
-
removeUser
Description copied from interface:RemoteDirectoryRemoves theuserthat matches the suppliedname.- Specified by:
removeUserin interfaceRemoteDirectory- Overrides:
removeUserin classSpringLDAPConnector- Parameters:
name- The name of the user (username).- Throws:
UserNotFoundException- The user does not exist.OperationFailedException- underlying directory implementation failed to execute the operation.
-
removeGroup
Description copied from interface:RemoteDirectoryRemoves thegroupthat matches the suppliedname.- Specified by:
removeGroupin interfaceRemoteDirectory- Overrides:
removeGroupin classSpringLDAPConnector- Parameters:
name- The name of the group.- Throws:
GroupNotFoundException- The group does not exist.OperationFailedException- underlying directory implementation failed to execute the operation.
-