public class DeltaQueryCacheRefresher extends Object implements CacheRefresher
If no delta tokens are present a full synchronisation using Azure AD's delta endpoints will be performed to obtain delta tokens for future incremental syncs.
As Azure AD returns a diff of group memberships, this cache refresher will add/remove the memberships specified by Azure AD instead of diffing current memberships with the ones obtained from the remote directory. This also causes a slight overhead due to the need to look up entity names for those memberships as Azure AD only specifies external ids and Crowd needs names. To facilitate this the names for added/changed entities are added into a cache local to a synchronisation and the cache is then populated whenever a lookup is performed.
This CacheRefresher uses worker threads for synchronisation. There are two reasons for this:
Modifier and Type | Class and Description |
---|---|
protected static interface |
DeltaQueryCacheRefresher.IdToNameProvider |
protected static interface |
DeltaQueryCacheRefresher.IdToNameResolver |
Modifier and Type | Field and Description |
---|---|
protected AzureAdDirectory |
azureAdDirectory |
Constructor and Description |
---|
DeltaQueryCacheRefresher(AzureAdDirectory remoteDirectory) |
protected final AzureAdDirectory azureAdDirectory
public DeltaQueryCacheRefresher(AzureAdDirectory remoteDirectory)
public CacheSynchronisationResult synchroniseAll(DirectoryCache directoryCache) throws OperationFailedException
CacheRefresher
synchroniseAll
in interface CacheRefresher
directoryCache
- the DirectoryCache to update.OperationFailedException
- if there was an error processing the operationprotected DeltaQueryResult<UserWithAttributes> getUsersFromDeltaQuery() throws OperationFailedException
OperationFailedException
protected DeltaQueryResult<UserWithAttributes> getUserChangesFromDeltaQuery(String userSyncToken) throws OperationFailedException
OperationFailedException
public CacheSynchronisationResult synchroniseChanges(DirectoryCache directoryCache, @Nullable String syncToken) throws OperationFailedException
CacheRefresher
synchroniseChanges
in interface CacheRefresher
directoryCache
- the DirectoryCache to update.OperationFailedException
- if there was an error processing the operationprotected Optional<DeltaQuerySyncTokenHolder> extractSyncToken(String syncToken)
protected boolean isValidToken(DeltaQuerySyncTokenHolder deltaQueryTokens)
protected void synchroniseMembershipChanges(DirectoryCache directoryCache, Collection<UserWithAttributes> mappedUsers, Collection<GroupWithMembershipChanges> mappedGroups) throws OperationFailedException
OperationFailedException
protected Set<String> getNames(Map<String,String> idToNameCache, Set<String> idsToResolve, DeltaQueryCacheRefresher.IdToNameProvider findById, boolean failOnNotResolved, String entityType) throws OperationFailedException
OperationFailedException
protected <T> Map<String,String> mapIdToUniqueNames(Collection<T> entities, Function<T,String> idMapper, Function<T,String> nameMapper, String entityName)
protected DeltaQueryCacheRefresher.IdToNameResolver usersResolver(Collection<UserWithAttributes> mappedUsers, DirectoryCache directoryCache)
protected DeltaQueryCacheRefresher.IdToNameResolver groupResolver(Collection<GroupWithMembershipChanges> mappedGroups, DirectoryCache directoryCache)
protected DeltaQueryResult<UserWithAttributes> synchroniseUserChanges(DirectoryCache directoryCache, DeltaQueryResult<UserWithAttributes> mappedUsers, Date syncStartDate) throws OperationFailedException
OperationFailedException
protected DeltaQueryResult<GroupWithMembershipChanges> synchroniseGroupChanges(DirectoryCache directoryCache, DeltaQueryResult<GroupWithMembershipChanges> mappedGroups, Date syncStartDate) throws OperationFailedException
OperationFailedException
protected void checkNoRenamedGroups(DirectoryCache directoryCache, DeltaQueryResult<GroupWithMembershipChanges> mappedGroups) throws OperationFailedException
OperationFailedException
protected void checkNoReaddedGroups(DirectoryCache directoryCache, DeltaQueryResult<GroupWithMembershipChanges> mappedGroups) throws OperationFailedException
OperationFailedException
protected <T> void handleNamelessEntities(DeltaQueryResult<T> mappedEntities, String entityType)
Copyright © 2020 Atlassian. All rights reserved.