public class DbCachingRemoteDirectory extends AbstractForwardingDirectory implements RemoteDirectory, SynchronisableDirectory, FastEntityCountProvider, MultiValuesQueriesSupport
RemoteDirectory that provides LDAP and Crowd integration plus local storage in an internal directory
for LDAP user and group attributes, and local groups for LDAP and Crowd users with local caching of remote data.
The implementation delegates to an Remote directory for the "source of truth" and an internal directory for caching
and some special local storage.
All the attributes for the directory itself (e.g. base DN, other configuration options) are stored on the directory instance.
Terminology used in this class:
| Constructor and Description |
|---|
DbCachingRemoteDirectory(RemoteDirectory remoteDirectory,
InternalRemoteDirectory internalDirectory,
DirectoryCacheFactory directoryCacheFactory,
CacheRefresherFactory cacheRefresherFactory,
AuditService auditService,
com.atlassian.crowd.manager.audit.mapper.AuditLogUserMapper auditLogUserMapper,
String directoryName,
com.atlassian.event.api.EventPublisher eventPublisher,
com.atlassian.crowd.embedded.spi.DirectoryDao directoryDao,
BatchConfigParser batchConfigParser) |
addUser, countDirectMembersOfGroup, findGroupByName, findGroupWithAttributesByName, findUserByExternalId, findUserByName, findUserWithAttributesByName, getMemberships, getUserAvatarByName, isGroupDirectGroupMember, isUserDirectGroupMember, searchGroupRelationships, searchGroups, searchUsersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddUser, countDirectMembersOfGroup, findGroupByName, findGroupWithAttributesByName, findUserByExternalId, findUserByName, findUserWithAttributesByName, getLocallyFilteredGroupNames, getMemberships, getUserAvatarByName, isGroupDirectGroupMember, isUserDirectGroupMember, searchGroupRelationships, searchGroups, searchUserssearchGroupRelationshipspublic DbCachingRemoteDirectory(RemoteDirectory remoteDirectory, InternalRemoteDirectory internalDirectory, DirectoryCacheFactory directoryCacheFactory, CacheRefresherFactory cacheRefresherFactory, AuditService auditService, com.atlassian.crowd.manager.audit.mapper.AuditLogUserMapper auditLogUserMapper, String directoryName, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.crowd.embedded.spi.DirectoryDao directoryDao, BatchConfigParser batchConfigParser)
public long getDirectoryId()
getDirectoryId in interface RemoteDirectorygetDirectoryId in class AbstractForwardingDirectorypublic void setDirectoryId(long directoryId)
setDirectoryId in interface RemoteDirectorysetDirectoryId in class AbstractForwardingDirectorypublic String getDescriptiveName()
getDescriptiveName in interface RemoteDirectorygetDescriptiveName in class AbstractForwardingDirectorypublic void setAttributes(Map<String,String> attributes)
setAttributes in interface RemoteDirectorysetAttributes in class AbstractForwardingDirectorypublic User authenticate(String name, PasswordCredential credential) throws UserNotFoundException, InactiveAccountException, InvalidAuthenticationException, ExpiredCredentialException, OperationFailedException
authenticate in interface RemoteDirectoryauthenticate in class AbstractForwardingDirectoryUserNotFoundExceptionInactiveAccountExceptionInvalidAuthenticationExceptionExpiredCredentialExceptionOperationFailedExceptionprotected User authenticateAndUpdateInternalUser(String name, PasswordCredential credential) throws UserNotFoundException, InactiveAccountException, InvalidAuthenticationException, ExpiredCredentialException, OperationFailedException
Updates user data (including groups membership) if the user exists in the internal directory. Renames user if necessary. If user does not exists tries to add the user and the user's memberships in the internal directory.
User might not exist in the internal directory yet because the user was added after the latest synchronisation. This happens for example when the remote directory uses delegated authentication, and creates users on successful authentication.
name - of the usercredential - credential of the userUserNotFoundException - if the user does not existExpiredCredentialException - if the password has expired and the user is required to change their passwordInactiveAccountException - if the user account is not activeInvalidAuthenticationException - if the user name/password combination is invalidOperationFailedException - if the operation failed for any other reasonpublic User updateUserFromRemoteDirectory(@Nonnull User remoteUser) throws OperationFailedException, UserNotFoundException
updateUserFromRemoteDirectory in interface RemoteDirectoryupdateUserFromRemoteDirectory in class AbstractForwardingDirectoryOperationFailedExceptionUserNotFoundExceptionpublic User userAuthenticated(String username) throws OperationFailedException, UserNotFoundException, InactiveAccountException
userAuthenticated in interface RemoteDirectoryOperationFailedExceptionUserNotFoundExceptionInactiveAccountExceptionprotected void checkIfUserCanBeUpdatedWithCurrentGroupFiltering(String username, Set<String> userRemoteGroupNames) throws OperationFailedException, UserNotFoundException
protected User updateUserAndSetActiveFlag(User remoteUser, User internalUser) throws UserNotFoundException, InvalidUserException, OperationFailedException
protected void updateGroupsMembershipOnLogin(User user, Set<String> userRemoteGroupNames) throws OperationFailedException, UserNotFoundException
public UserWithAttributes addUser(UserTemplateWithAttributes user, PasswordCredential credential) throws InvalidUserException, InvalidCredentialException, UserAlreadyExistsException, OperationFailedException
addUser in interface RemoteDirectoryaddUser in class AbstractForwardingDirectoryInvalidUserExceptionInvalidCredentialExceptionUserAlreadyExistsExceptionOperationFailedExceptionpublic User updateUser(UserTemplate user) throws InvalidUserException, UserNotFoundException, OperationFailedException
updateUser in interface RemoteDirectoryupdateUser in class AbstractForwardingDirectoryInvalidUserExceptionUserNotFoundExceptionOperationFailedExceptionpublic void updateUserCredential(String username, PasswordCredential credential) throws UserNotFoundException, InvalidCredentialException, OperationFailedException
updateUserCredential in interface RemoteDirectoryupdateUserCredential in class AbstractForwardingDirectoryUserNotFoundExceptionInvalidCredentialExceptionOperationFailedExceptionpublic User renameUser(String oldName, String newName) throws UserNotFoundException, InvalidUserException, OperationFailedException, UserAlreadyExistsException
renameUser in interface RemoteDirectoryrenameUser in class AbstractForwardingDirectoryUserNotFoundExceptionInvalidUserExceptionOperationFailedExceptionUserAlreadyExistsExceptionpublic void storeUserAttributes(String username, Map<String,Set<String>> attributes) throws UserNotFoundException, OperationFailedException
storeUserAttributes in interface RemoteDirectorystoreUserAttributes in class AbstractForwardingDirectoryUserNotFoundExceptionOperationFailedExceptionpublic void removeUserAttributes(String username, String attributeName) throws UserNotFoundException, OperationFailedException
removeUserAttributes in interface RemoteDirectoryremoveUserAttributes in class AbstractForwardingDirectoryUserNotFoundExceptionOperationFailedExceptionpublic void removeUser(String name) throws UserNotFoundException, OperationFailedException
removeUser in interface RemoteDirectoryremoveUser in class AbstractForwardingDirectoryUserNotFoundExceptionOperationFailedExceptionpublic Group addGroup(GroupTemplate group) throws InvalidGroupException, OperationFailedException
addGroup in interface RemoteDirectoryaddGroup in class AbstractForwardingDirectoryInvalidGroupExceptionOperationFailedExceptionpublic Group updateGroup(GroupTemplate group) throws InvalidGroupException, GroupNotFoundException, OperationFailedException, ReadOnlyGroupException
updateGroup in interface RemoteDirectoryupdateGroup in class AbstractForwardingDirectoryInvalidGroupExceptionGroupNotFoundExceptionOperationFailedExceptionReadOnlyGroupExceptionpublic Group renameGroup(String oldName, String newName) throws GroupNotFoundException, InvalidGroupException
renameGroup in interface RemoteDirectoryrenameGroup in class AbstractForwardingDirectoryGroupNotFoundExceptionInvalidGroupExceptionpublic void storeGroupAttributes(String groupName, Map<String,Set<String>> attributes) throws GroupNotFoundException, OperationFailedException
storeGroupAttributes in interface RemoteDirectorystoreGroupAttributes in class AbstractForwardingDirectoryGroupNotFoundExceptionOperationFailedExceptionpublic void removeGroupAttributes(String groupName, String attributeName) throws GroupNotFoundException, OperationFailedException
removeGroupAttributes in interface RemoteDirectoryremoveGroupAttributes in class AbstractForwardingDirectoryGroupNotFoundExceptionOperationFailedExceptionpublic void removeGroup(String name) throws GroupNotFoundException, OperationFailedException, ReadOnlyGroupException
removeGroup in interface RemoteDirectoryremoveGroup in class AbstractForwardingDirectoryGroupNotFoundExceptionOperationFailedExceptionReadOnlyGroupExceptionpublic void addUserToGroup(String username, String groupName) throws GroupNotFoundException, UserNotFoundException, OperationFailedException, ReadOnlyGroupException, MembershipAlreadyExistsException
addUserToGroup in interface RemoteDirectoryaddUserToGroup in class AbstractForwardingDirectoryGroupNotFoundExceptionUserNotFoundExceptionOperationFailedExceptionReadOnlyGroupExceptionMembershipAlreadyExistsExceptionpublic void addGroupToGroup(String childGroup, String parentGroup) throws GroupNotFoundException, InvalidMembershipException, OperationFailedException, ReadOnlyGroupException, MembershipAlreadyExistsException
addGroupToGroup in interface RemoteDirectoryaddGroupToGroup in class AbstractForwardingDirectoryGroupNotFoundExceptionInvalidMembershipExceptionOperationFailedExceptionReadOnlyGroupExceptionMembershipAlreadyExistsExceptionpublic void removeUserFromGroup(String username, String groupName) throws GroupNotFoundException, UserNotFoundException, MembershipNotFoundException, OperationFailedException, ReadOnlyGroupException
removeUserFromGroup in interface RemoteDirectoryremoveUserFromGroup in class AbstractForwardingDirectoryGroupNotFoundExceptionUserNotFoundExceptionMembershipNotFoundExceptionOperationFailedExceptionReadOnlyGroupExceptionpublic void removeGroupFromGroup(String childGroup, String parentGroup) throws GroupNotFoundException, InvalidMembershipException, MembershipNotFoundException, OperationFailedException, ReadOnlyGroupException
removeGroupFromGroup in interface RemoteDirectoryremoveGroupFromGroup in class AbstractForwardingDirectoryGroupNotFoundExceptionInvalidMembershipExceptionMembershipNotFoundExceptionOperationFailedExceptionReadOnlyGroupExceptionpublic void testConnection()
throws OperationFailedException
testConnection in interface RemoteDirectorytestConnection in class AbstractForwardingDirectoryOperationFailedExceptionpublic boolean supportsInactiveAccounts()
supportsInactiveAccounts in interface RemoteDirectorysupportsInactiveAccounts in class AbstractForwardingDirectorypublic boolean supportsNestedGroups()
supportsNestedGroups in interface RemoteDirectorysupportsNestedGroups in class AbstractForwardingDirectorypublic boolean supportsPasswordExpiration()
supportsPasswordExpiration in interface RemoteDirectorysupportsPasswordExpiration in class AbstractForwardingDirectorypublic boolean supportsSettingEncryptedCredential()
supportsSettingEncryptedCredential in interface RemoteDirectorysupportsSettingEncryptedCredential in class AbstractForwardingDirectorypublic boolean isRolesDisabled()
isRolesDisabled in interface RemoteDirectoryisRolesDisabled in class AbstractForwardingDirectoryprotected boolean shouldSyncGroupMembershipAfterUserAuthentication(boolean isNewUser)
isNewUser - true if the user was created during authentication (ie. wasn't synced yet, and was created during this authentication)SynchronisableDirectoryProperties.SYNC_GROUP_MEMBERSHIP_AFTER_SUCCESSFUL_USER_AUTH_ENABLEDpublic Set<String> getValues(String name)
getValues in interface AttributesgetValues in class AbstractForwardingDirectorypublic String getValue(String name)
getValue in interface AttributesgetValue in class AbstractForwardingDirectorypublic boolean isEmpty()
isEmpty in interface AttributesisEmpty in class AbstractForwardingDirectorypublic Set<String> getKeys()
getKeys in interface AttributesgetKeys in class AbstractForwardingDirectorypublic boolean isIncrementalSyncEnabled()
isIncrementalSyncEnabled in interface SynchronisableDirectorypublic void synchroniseCache(SynchronisationMode mode, SynchronisationStatusManager synchronisationStatusManager) throws OperationFailedException
synchroniseCache in interface SynchronisableDirectoryOperationFailedExceptionpublic RemoteDirectory getAuthoritativeDirectory()
getAuthoritativeDirectory in interface RemoteDirectorygetAuthoritativeDirectory in class AbstractForwardingDirectorypublic void expireAllPasswords()
throws OperationFailedException
expireAllPasswords in interface RemoteDirectoryexpireAllPasswords in class AbstractForwardingDirectoryOperationFailedExceptionpublic long getUserCount()
throws OperationFailedException
getUserCount in interface FastEntityCountProviderOperationFailedExceptionpublic long getGroupCount()
throws OperationFailedException
getGroupCount in interface FastEntityCountProviderOperationFailedExceptionprotected InternalRemoteDirectory getDelegate()
getDelegate in class AbstractForwardingDirectorypublic <T> com.google.common.collect.ListMultimap<String,T> searchGroupRelationshipsGroupedByName(MembershipQuery<T> query)
searchGroupRelationshipsGroupedByName in interface MultiValuesQueriesSupportCopyright © 2023 Atlassian. All rights reserved.