Class SpringLDAPConnector
- All Implemented Interfaces:
LDAPDirectory,RemoteDirectory,Attributes
- Direct Known Subclasses:
RFC2307Directory,RFC4519Directory
Warning: CWD-2494: When read timeout is enabled, operations can fail randomly with "javax.naming.NamingException: LDAP response read timed out..." error message without waiting for the timeout to pass.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AttributeValuesHolderprotected Supplier<org.springframework.ldap.core.ContextSource>protected Supplier<org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManager>static final intprotected final com.atlassian.event.api.EventPublisherprotected LDAPPropertiesMapperprotected final LDAPQueryTranslaterprotected Supplier<SpringLdapTemplateWrapper>protected Converterprotected SearchDN -
Constructor Summary
ConstructorsConstructorDescriptionSpringLDAPConnector(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory, LdapContextSourceProvider ldapContextSourceProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDefaultSnToUserAttributes(Attributes attrs, String defaultSnValue) A default install of many directory servers (inc.protected voidaddDefaultValueToUserAttributesForAttribute(String attributeName, Attributes attrs, String defaultValue) addGroup(GroupTemplate group) addUser(UserTemplate user, PasswordCredential credential) Adds a user to LDAP.addUser(UserTemplateWithAttributes user, PasswordCredential credential) Adds a user to LDAP.authenticate(String name, PasswordCredential credential) countDirectMembersOfGroup(String groupName, int querySizeHint) protected static ModificationItemcreateModificationItem(String directoryAttributeName, String oldValue, String newValue) This method is not suitable for generic attribute updates as it only supports single attribute-value mappings (ie.voidprotected <T extends LDAPDirectoryEntity>
TfindEntityByDN(CrowdLdapName entityDn, CrowdLdapName baseDn, String filter, ContextMapperWithRequiredAttributes contextMapper, Class<T> entityClass) <T extends LDAPDirectoryEntity>
TfindEntityByDN(CrowdLdapName dn, Class<T> entityClass) Finds a directory entity (principal, group or role) by their distinguished name.<T extends LDAPDirectoryEntity>
TfindEntityByDN(String dn, Class<T> entityClass) findGroupByName(String name) protected LDAPGroupWithAttributesfindGroupByNameAndType(String name, GroupType groupType) findUserByExternalId(String externalId) findUserByName(String name) booleangetAttributeAsBoolean(String name, boolean defaultValue) longgetAttributeAsLong(String name, long defaultValue) Returns the properties used to set up the Ldap ContextSource.org.springframework.ldap.core.ContextSourceExposed so that delegated directories can get a handle on the underlying LDAP context.protected abstract LDAPCredentialEncoderprotected List<AttributeMapper>As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available).protected List<AttributeMapper>longgetGroupContextMapper(GroupType groupType, boolean withAllAttributes) Returns a ContextMapper ready to translate LDAP objects into Groups.getGroupContextMapper(GroupType groupType, boolean withAllAttributes, boolean withMemberAttributes) Returns a ContextMapper ready to translate LDAP objects into Groups.protected StringReturns the default container member DN.getKeys()protected List<AttributeMapper>As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available).protected AttributesgetNewGroupAttributes(Group group) protected voidgetNewGroupDirectorySpecificAttributes(Group group, Attributes attributes) Populates attributes object with directory-specific attributes.protected AttributesgetNewUserAttributes(User user, PasswordCredential credential) Translates theUserinto LDAP attributes, in preparation for creating a new user.protected voidgetNewUserDirectorySpecificAttributes(User user, Attributes attributes) Populates attributes object with directory-specific attributes.protected List<AttributeMapper>Returns a set of attributes which are expected to be present in all cases (ie Active Directory's objectGUID) Due to performance reasons returning mappers for heavy attributes (such as memberships) should be avoidedprotected SearchControlsgetSearchControls(ContextMapperWithRequiredAttributes<?> mapper, int scope) getUserAvatarByName(String username, int sizeHint) protected List<ModificationItem>getUserModificationItems(User userTemplate, LDAPUserWithAttributes currentUser) booleanisEmpty()booleanprotected org.springframework.ldap.core.CollectingNameClassPairCallbackHandlerpageSearchResults(CrowdLdapName baseDN, String filter, org.springframework.ldap.core.ContextMapper contextMapper, SearchControls searchControls, org.springframework.ldap.core.DirContextProcessor ldapRequestControls, int maxResults) Performs a paged results search on an LDAP directory server searching using the LDAP paged results control option to fetch results in chunks rather than all at once.protected LDAPGroupWithAttributesPerform any post-processing on the passed group.protected List<LDAPGroupWithAttributes>postprocessGroups(List<LDAPGroupWithAttributes> groups) Perform any post-processing on groups.voidremoveGroup(String name) voidremoveGroupAttributes(String groupName, String attributeName) voidremoveUser(String name) voidremoveUserAttributes(String username, String attributeName) renameGroup(String oldName, String newName) renameUser(String oldName, String newName) protected <T> List<T>searchEntities(CrowdLdapName baseDN, String filter, ContextMapperWithRequiredAttributes<T> contextMapper, int startIndex, int maxResults) Executes a search with paging if paged results is supported.protected <T> List<T>searchEntitiesWithRequestControls(CrowdLdapName baseDN, String filter, ContextMapperWithRequiredAttributes<T> contextMapper, SearchControls searchControls, org.springframework.ldap.core.DirContextProcessor ldapRequestControls, int startIndex, int maxResults) <T> List<T>searchGroupObjects(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) protected <T> List<T>searchGroupObjectsOfSpecifiedGroupType(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) This method expects that the query contains a non-null groupType in the entityDescriptor.<T> List<T>searchGroupRelationships(MembershipQuery<T> query) protected abstract <T> Iterable<T>Execute the search for group relationships given that a group of type GROUP or LEGACY_ROLE has been specified in the EntityDescriptor for the group(s).<T> List<T>searchGroups(EntityQuery<T> query) <T> List<T>searchUserObjects(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) <T> List<T>searchUsers(EntityQuery<T> query) <T> List<T>searchUsers(EntityQuery<T> query, boolean includeMembershipForAllDetails) voidsetAttributes(Map<String, String> attributes) Called by theDirectoryInstanceLoaderafter constructing an InternalDirectory.voidsetDirectoryId(long id) Called by theDirectoryInstanceLoaderafter constructing an InternalDirectory.protected voidsetLdapPropertiesMapperAttributes(Map<String, String> attributes) voidvoidbooleanStoring active/inactive flag for users in LDAP in general is currently not supported.booleanbooleanWe don't support expiring passwords in LDAP directories (yet).booleanvoidprotected <T extends LDAPDirectoryEntity>
RuntimeExceptiontypedEntityNotFoundException(String name, Class<T> entityClass) updateGroup(GroupTemplate group) updateUser(UserTemplate user) voidupdateUserCredential(String name, PasswordCredential credential) Methods 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
addGroupToGroup, addUserToGroup, getDescriptiveName, getLocallyFilteredGroupNames, getMemberships, isGroupDirectGroupMember, isUserDirectGroupMember, removeGroupFromGroup, removeUserFromGroup, updateUserFromRemoteDirectory, userAuthenticated
-
Field Details
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE- See Also:
-
attributes
-
ldapTemplate
-
contextSource
-
nameConverter
-
searchDN
-
ldapPropertiesMapper
-
contextSourceTransactionManager
protected volatile Supplier<org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManager> contextSourceTransactionManager -
ldapQueryTranslater
-
eventPublisher
protected final com.atlassian.event.api.EventPublisher eventPublisher
-
-
Constructor Details
-
SpringLDAPConnector
public SpringLDAPConnector(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory, LdapContextSourceProvider ldapContextSourceProvider)
-
-
Method Details
-
countDirectMembersOfGroup
public BoundedCount countDirectMembersOfGroup(String groupName, int querySizeHint) throws OperationFailedException - Specified by:
countDirectMembersOfGroupin interfaceRemoteDirectory- Throws:
OperationFailedException
-
getDirectoryId
public long getDirectoryId()- Specified by:
getDirectoryIdin interfaceRemoteDirectory
-
setDirectoryId
public void setDirectoryId(long id) Called by theDirectoryInstanceLoaderafter constructing an InternalDirectory.- Specified by:
setDirectoryIdin interfaceRemoteDirectory- Parameters:
id- The uniqueidof the Directory stored in the database.
-
setAttributes
Called by theDirectoryInstanceLoaderafter constructing an InternalDirectory.- Specified by:
setAttributesin interfaceRemoteDirectory- Parameters:
attributes- attributes map.
-
setLdapPropertiesMapperAttributes
-
getContextSource
public org.springframework.ldap.core.ContextSource getContextSource()Exposed so that delegated directories can get a handle on the underlying LDAP context.- Returns:
- ContextSource.
-
getLdapPropertiesMapper
-
getValues
- Specified by:
getValuesin interfaceAttributes
-
getValue
- Specified by:
getValuein interfaceAttributes
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceAttributes
-
getAttributeAsLong
-
getAttributeAsBoolean
-
getKeys
- Specified by:
getKeysin interfaceAttributes
-
getSearchDN
-
getSearchControls
protected SearchControls getSearchControls(ContextMapperWithRequiredAttributes<?> mapper, int scope) -
getBaseEnvironmentProperties
Returns the properties used to set up the Ldap ContextSource.- Returns:
- the properties used to set up the Ldap ContextSource.
-
pageSearchResults
protected org.springframework.ldap.core.CollectingNameClassPairCallbackHandler pageSearchResults(CrowdLdapName baseDN, String filter, org.springframework.ldap.core.ContextMapper contextMapper, SearchControls searchControls, org.springframework.ldap.core.DirContextProcessor ldapRequestControls, int maxResults) throws OperationFailedException Performs a paged results search on an LDAP directory server searching using the LDAP paged results control option to fetch results in chunks rather than all at once.- Parameters:
baseDN- The DN to begin the search from.filter- The search filter.contextMapper- Maps from LDAP search results into objects such asGroups.searchControls- The LDAP search scope type.ldapRequestControls- Any LDAP request controls (set tonullif you do not need additional request controls for the search).maxResults- maximum number of results to return. Set to-1if no result limiting is desired (WARNING: doing so is obviously a hazard).- Returns:
- The search results.
- Throws:
OperationFailedException- Search failed due to a communication error to the remote directory
-
searchEntities
protected <T> List<T> searchEntities(CrowdLdapName baseDN, String filter, ContextMapperWithRequiredAttributes<T> contextMapper, int startIndex, int maxResults) throws OperationFailedException Executes a search with paging if paged results is supported.- Parameters:
baseDN- base DN of search.filter- encoded LDAP search filter.contextMapper- directory context to object mapper.startIndex- index to start at. Set to0to start from the first result.maxResults- maximum number of results to return. Set to-1if no result limiting is desired (WARNING: doing so is obviously a hazard).- Returns:
- list of entities of type corresponding to the contextMapper's output.
- Throws:
OperationFailedException- a Communication error occurred when trying to talk to a remote directory
-
searchEntitiesWithRequestControls
protected <T> List<T> searchEntitiesWithRequestControls(CrowdLdapName baseDN, String filter, ContextMapperWithRequiredAttributes<T> contextMapper, SearchControls searchControls, org.springframework.ldap.core.DirContextProcessor ldapRequestControls, int startIndex, int maxResults) throws OperationFailedException - Throws:
OperationFailedException
-
createModificationItem
protected static ModificationItem createModificationItem(String directoryAttributeName, String oldValue, String newValue) This method is not suitable for generic attribute updates as it only supports single attribute-value mappings (ie. suitable for field values as opposed to custom attributes).- Parameters:
directoryAttributeName- the name of the attribute in LDAP to potentially add or modify.oldValue- the value load from the LDAP directory (i.e. already processed byDirectoryAttributeRetriever.fromSavedLDAPValue(String))newValue- the value which should be saved into LDAP (i.e. NOT processed byDirectoryAttributeRetriever.toSaveableLDAPValue(String)yet)
-
getCustomUserAttributeMappers
- Returns:
- a collection of custom attribute mappers. By default just return an empty list.
-
getGroupContextMapper
public ContextMapperWithRequiredAttributes<LDAPGroupWithAttributes> getGroupContextMapper(GroupType groupType, boolean withAllAttributes) Returns a ContextMapper ready to translate LDAP objects into Groups.- Parameters:
groupType- the GroupTypewithAllAttributes- determines if all additional attribute mappers should be included. Some directories may include additional attributes, which are expected to be present in all cases- Returns:
- a ContextMapper ready to translate LDAP objects into Groups and fetches all member objects
-
getGroupContextMapper
public ContextMapperWithRequiredAttributes<LDAPGroupWithAttributes> getGroupContextMapper(GroupType groupType, boolean withAllAttributes, boolean withMemberAttributes) Returns a ContextMapper ready to translate LDAP objects into Groups.- Parameters:
groupType- the GroupTypewithAllAttributes- determines if all additional attribute mappers should be included. Some directories may include additional attributes, which are expected to be present in all caseswithMemberAttributes- include the additional attributes mappers to obtain group members.- Returns:
- a ContextMapper ready to translate LDAP objects into Groups and fetches all member objects
-
getCustomGroupAttributeMappers
As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available).- Returns:
- collection of custom attribute mappers (cannot be
nullbut can be an empty list).
-
getMemberOnlyGroupAttributeMappers
As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available).- Returns:
- collection of custom attribute mappers (cannot be
nullbut can be an empty list).
-
getRequiredCustomGroupAttributeMappers
Returns a set of attributes which are expected to be present in all cases (ie Active Directory's objectGUID) Due to performance reasons returning mappers for heavy attributes (such as memberships) should be avoided- Returns:
- a list of mappers for attributes required to be present in all cases
-
findUserByName
public LDAPUserWithAttributes findUserByName(String name) throws UserNotFoundException, OperationFailedException - Specified by:
findUserByNamein interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
findUserWithAttributesByName
public LDAPUserWithAttributes findUserWithAttributesByName(String name) throws UserNotFoundException, OperationFailedException - Specified by:
findUserWithAttributesByNamein interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
findUserByExternalId
public LDAPUserWithAttributes findUserByExternalId(String externalId) throws UserNotFoundException, OperationFailedException - Specified by:
findUserByExternalIdin interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
searchUserObjects
public <T> List<T> searchUserObjects(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) throws OperationFailedException, IllegalArgumentException -
removeUser
- Specified by:
removeUserin interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
updateUserCredential
public void updateUserCredential(String name, PasswordCredential credential) throws InvalidCredentialException, UserNotFoundException, OperationFailedException - Specified by:
updateUserCredentialin interfaceRemoteDirectory- Throws:
InvalidCredentialExceptionUserNotFoundExceptionOperationFailedException
-
renameUser
public User renameUser(String oldName, String newName) throws UserNotFoundException, InvalidUserException, OperationFailedException - Specified by:
renameUserin interfaceRemoteDirectory- Throws:
UserNotFoundExceptionInvalidUserExceptionOperationFailedException
-
storeUserAttributes
public void storeUserAttributes(String username, Map<String, Set<String>> attributes) throws UserNotFoundException, OperationFailedException- Specified by:
storeUserAttributesin interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
removeUserAttributes
public void removeUserAttributes(String username, String attributeName) throws UserNotFoundException, OperationFailedException - Specified by:
removeUserAttributesin interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
getNewUserAttributes
protected Attributes getNewUserAttributes(User user, PasswordCredential credential) throws InvalidCredentialException, org.springframework.ldap.NamingException Translates theUserinto LDAP attributes, in preparation for creating a new user.- Parameters:
user- The user object to translate into LDAP attributescredential- raw password.- Returns:
- An Attributes object populated with directory-specific information.
- Throws:
InvalidCredentialException- The password, if supplied, was invalid in some manner.org.springframework.ldap.NamingException- If theUsercould not be translated to anAttributes
-
getNewUserDirectorySpecificAttributes
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.
- Parameters:
user- (potential) source of information that needs to be added.attributes- attributes to add directory-specific information to.
-
addUser
public LDAPUserWithAttributes addUser(UserTemplate user, PasswordCredential credential) throws InvalidUserException, InvalidCredentialException, OperationFailedException Adds a user to LDAP.- Specified by:
addUserin interfaceRemoteDirectory- 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.
-
addUser
public LDAPUserWithAttributes addUser(UserTemplateWithAttributes user, PasswordCredential credential) throws InvalidUserException, InvalidCredentialException, OperationFailedException Adds a user to LDAP.- Specified by:
addUserin interfaceRemoteDirectory- 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.
-
addDefaultSnToUserAttributes
A default install of many directory servers (inc. Sun DSEE 6.2 and Apache DS 1.0.2) requires the following to be set before user creation is allowed:objectClass -> inetorgperson cn -> sn ->
If a call is being made from an external system (eg JIRA), the user is created with the bare minimum of attributes, then later updated. We need to make sure to addsnif it's not present in the information provided.- Parameters:
attrs- The LDAP user attributes to be checked and potentially updated.defaultSnValue- default lastname/surname value
-
addDefaultValueToUserAttributesForAttribute
protected void addDefaultValueToUserAttributesForAttribute(String attributeName, Attributes attrs, String defaultValue) -
findEntityByDN
public <T extends LDAPDirectoryEntity> T findEntityByDN(String dn, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException, OperationFailedException -
findEntityByDN
public <T extends LDAPDirectoryEntity> T findEntityByDN(CrowdLdapName dn, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException, OperationFailedException Description copied from interface:LDAPDirectoryFinds a directory entity (principal, group or role) by their distinguished name.The object class of an entity is used to determine the entity type.
If an object represents both a group and role, then the object is mapped to a group.
- Specified by:
findEntityByDNin interfaceLDAPDirectory- Parameters:
dn- standardised distinguished name.entityClass- class of the entity to find (eitherLDAPUserWithAttributesorLDAPGroupWithAttributes).- Returns:
- directory entity corresponding to DN.
- Throws:
UserNotFoundException- if a user 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.GroupNotFoundException- if a user 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.OperationFailedException- if underlying directory implementation failed to execute the operation.
-
typedEntityNotFoundException
protected <T extends LDAPDirectoryEntity> RuntimeException typedEntityNotFoundException(String name, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException -
findEntityByDN
protected <T extends LDAPDirectoryEntity> T findEntityByDN(CrowdLdapName entityDn, CrowdLdapName baseDn, String filter, ContextMapperWithRequiredAttributes contextMapper, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException, OperationFailedException -
updateUser
- Specified by:
updateUserin interfaceRemoteDirectory- Throws:
UserNotFoundExceptionOperationFailedException
-
getUserModificationItems
protected List<ModificationItem> getUserModificationItems(User userTemplate, LDAPUserWithAttributes currentUser) -
searchUsers
- Specified by:
searchUsersin interfaceRemoteDirectory- Throws:
OperationFailedException
-
searchUsers
public <T> List<T> searchUsers(EntityQuery<T> query, boolean includeMembershipForAllDetails) throws OperationFailedException - Throws:
OperationFailedException
-
authenticate
public User authenticate(String name, PasswordCredential credential) throws InvalidAuthenticationException, UserNotFoundException, OperationFailedException - Specified by:
authenticatein interfaceRemoteDirectory- Throws:
InvalidAuthenticationExceptionUserNotFoundExceptionOperationFailedException
-
findGroupByName
public LDAPGroupWithAttributes findGroupByName(String name) throws GroupNotFoundException, OperationFailedException - Specified by:
findGroupByNamein interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionOperationFailedException
-
findGroupWithAttributesByName
public LDAPGroupWithAttributes findGroupWithAttributesByName(String name) throws GroupNotFoundException, OperationFailedException - Specified by:
findGroupWithAttributesByNamein interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionOperationFailedException
-
findGroupByNameAndType
protected LDAPGroupWithAttributes findGroupByNameAndType(String name, GroupType groupType) throws GroupNotFoundException, OperationFailedException -
searchGroupObjectsOfSpecifiedGroupType
protected <T> List<T> searchGroupObjectsOfSpecifiedGroupType(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) throws OperationFailedException This method expects that the query contains a non-null groupType in the entityDescriptor.- Parameters:
query- search query.- Returns:
- list of results.
- Throws:
OperationFailedException- represents a Communication error when trying to talk to a remote directory
-
searchGroupObjects
public <T> List<T> searchGroupObjects(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) throws OperationFailedException - Throws:
OperationFailedException
-
searchGroups
- Specified by:
searchGroupsin interfaceRemoteDirectory- Throws:
OperationFailedException
-
postprocessGroups
Perform any post-processing on groups.- Parameters:
groups- to post-process- Returns:
- list of groups that have been processed if required
-
postprocessGroup
Perform any post-processing on the passed group.- Parameters:
group- to post-process- Returns:
- the group (updated if required)
- Throws:
OperationFailedException- if processing encounters a problem with the underlying directory
-
getNewGroupAttributes
protected Attributes getNewGroupAttributes(Group group) throws org.springframework.ldap.NamingException - Throws:
org.springframework.ldap.NamingException
-
getNewGroupDirectorySpecificAttributes
Populates attributes object with directory-specific attributes.Overrider of this method can take advantage of the default group attributes mapping logic in {#getNewGroupAttributes(Group)}.
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.
- Parameters:
group- (potential) source of information that needs to be added.attributes- attributes to add directory-specific information to.
-
getInitialGroupMemberDN
Returns the default container member DN.If this method returns null or blank string, no member DN will be added.
- Returns:
- empty member.
-
addGroup
- Specified by:
addGroupin interfaceRemoteDirectory- Throws:
InvalidGroupExceptionOperationFailedException
-
updateGroup
public Group updateGroup(GroupTemplate group) throws GroupNotFoundException, OperationFailedException - Specified by:
updateGroupin interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionOperationFailedException
-
removeGroup
- Specified by:
removeGroupin interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionOperationFailedException
-
renameGroup
public Group renameGroup(String oldName, String newName) throws GroupNotFoundException, InvalidGroupException, OperationFailedException - Specified by:
renameGroupin interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionInvalidGroupExceptionOperationFailedException
-
storeGroupAttributes
public void storeGroupAttributes(String groupName, Map<String, Set<String>> attributes) throws GroupNotFoundException, OperationFailedException- Specified by:
storeGroupAttributesin interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionOperationFailedException
-
removeGroupAttributes
public void removeGroupAttributes(String groupName, String attributeName) throws GroupNotFoundException, OperationFailedException - Specified by:
removeGroupAttributesin interfaceRemoteDirectory- Throws:
GroupNotFoundExceptionOperationFailedException
-
searchGroupRelationships
public <T> List<T> searchGroupRelationships(MembershipQuery<T> query) throws OperationFailedException - Specified by:
searchGroupRelationshipsin interfaceRemoteDirectory- Throws:
OperationFailedException
-
searchGroupRelationshipsWithGroupTypeSpecified
protected abstract <T> Iterable<T> searchGroupRelationshipsWithGroupTypeSpecified(MembershipQuery<T> query) throws OperationFailedException Execute the search for group relationships given that a group of type GROUP or LEGACY_ROLE has been specified in the EntityDescriptor for the group(s).- Parameters:
query- membership query with all GroupType's not null.- Returns:
- list of members or memberships depending on the query.
- Throws:
OperationFailedException- if the operation failed due to a communication error with the remote directory, or if the query is invalid
-
getCredentialEncoder
- Returns:
- the credential encoder to use with this directory; must not be null.
-
supportsSettingEncryptedCredential
public boolean supportsSettingEncryptedCredential()- Specified by:
supportsSettingEncryptedCredentialin interfaceRemoteDirectory
-
supportsPasswordExpiration
public boolean supportsPasswordExpiration()We don't support expiring passwords in LDAP directories (yet).- Specified by:
supportsPasswordExpirationin interfaceRemoteDirectory- Returns:
false, always.
-
expireAllPasswords
- Specified by:
expireAllPasswordsin interfaceRemoteDirectory- Throws:
OperationFailedException
-
supportsNestedGroups
public boolean supportsNestedGroups()- Specified by:
supportsNestedGroupsin interfaceRemoteDirectory
-
isRolesDisabled
public boolean isRolesDisabled()- Specified by:
isRolesDisabledin interfaceRemoteDirectory
-
testConnection
- Specified by:
testConnectionin interfaceRemoteDirectory- Throws:
OperationFailedException
-
supportsInactiveAccounts
public boolean supportsInactiveAccounts()Storing active/inactive flag for users in LDAP in general is currently not supported.- Specified by:
supportsInactiveAccountsin interfaceRemoteDirectory- Returns:
- false
-
getAuthoritativeDirectory
- Specified by:
getAuthoritativeDirectoryin interfaceRemoteDirectory
-
avatarMapper
-
getUserAvatarByName
public AvatarReference.BlobAvatar getUserAvatarByName(String username, int sizeHint) throws OperationFailedException - Specified by:
getUserAvatarByNamein interfaceRemoteDirectory- Throws:
OperationFailedException
-