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
ConstructorDescriptionRfc2307
(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory, PasswordEncoderFactory passwordEncoderFactory, LdapContextSourceProvider ldapContextSourceProvider) -
Method Summary
Modifier and TypeMethodDescriptionaddGroup
(GroupTemplate group) Adds agroup
to the directory store.void
addGroupToGroup
(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.void
addUserToGroup
(String username, String groupName) Adds a user as a member of a group.protected LDAPCredentialEncoder
Returns a descriptive name for the type of directory.protected void
getNewUserDirectorySpecificAttributes
(User user, Attributes attributes) Populates attributes object with directory-specific attributes.static String
void
removeGroup
(String name) Removes thegroup
that matches the suppliedname
.void
removeGroupFromGroup
(String childGroup, String parentGroup) Removes a group as a member of a parent group.void
removeUser
(String name) Removes theuser
that matches the suppliedname
.void
removeUserFromGroup
(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, supportsPasswordExpiration
Methods 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, updateUserCredential
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.crowd.directory.RemoteDirectory
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:
getCredentialEncoder
in classSpringLDAPConnector
- Returns:
- the credential encoder to use with this directory; must not be null.
-
getNewUserDirectorySpecificAttributes
Description copied from class:SpringLDAPConnector
Populates 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:
getNewUserDirectorySpecificAttributes
in 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:RemoteDirectory
Returns 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:RemoteDirectory
Adds a user as a member of a group. This means that all user members ofchildGroup
will appear as members ofparentGroup
to querying applications.- Parameters:
username
- The user that will become a member ofgroupName
groupName
- 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:RemoteDirectory
Adds a group as a member of a parent group.- Parameters:
childGroup
- The group that will become a member ofparentGroup
parentGroup
- 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:RemoteDirectory
Removes a user as a member of a group.- Parameters:
username
- The user that will be removed fromparentGroup
groupName
- 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:RemoteDirectory
Removes a group as a member of a parent group.- Parameters:
childGroup
- The group that will be removed fromparentGroup
parentGroup
- 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:SpringLDAPConnector
Adds a user to LDAP.- Specified by:
addUser
in interfaceRemoteDirectory
- Overrides:
addUser
in 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:SpringLDAPConnector
Adds a user to LDAP.- Specified by:
addUser
in interfaceRemoteDirectory
- Overrides:
addUser
in 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:RemoteDirectory
Adds agroup
to the directory store.- Specified by:
addGroup
in interfaceRemoteDirectory
- Overrides:
addGroup
in 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:RemoteDirectory
Renames agroup
.- Specified by:
renameGroup
in interfaceRemoteDirectory
- Overrides:
renameGroup
in 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:RemoteDirectory
Renames auser
.- Specified by:
renameUser
in interfaceRemoteDirectory
- Overrides:
renameUser
in 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:RemoteDirectory
Updates thegroup
.- Specified by:
updateGroup
in interfaceRemoteDirectory
- Overrides:
updateGroup
in 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:RemoteDirectory
Updates theuser
.- Specified by:
updateUser
in interfaceRemoteDirectory
- Overrides:
updateUser
in 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:RemoteDirectory
Removes theuser
that matches the suppliedname
.- Specified by:
removeUser
in interfaceRemoteDirectory
- Overrides:
removeUser
in 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:RemoteDirectory
Removes thegroup
that matches the suppliedname
.- Specified by:
removeGroup
in interfaceRemoteDirectory
- Overrides:
removeGroup
in classSpringLDAPConnector
- Parameters:
name
- The name of the group.- Throws:
GroupNotFoundException
- The group does not exist.OperationFailedException
- underlying directory implementation failed to execute the operation.
-