Class ChainingUserRegistrySynchronizer
- All Implemented Interfaces:
EventListener,ChainingUserRegistrySynchronizerStatus,TestableChainingUserRegistrySynchronizer,UserRegistrySynchronizer,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.ApplicationListener
ChainingUserRegistrySynchronizer is responsible for synchronizing Alfresco's local user (person) and
group (authority) information with the external subsystems in the authentication chain (most typically LDAP
directories). When the synchronize(boolean, boolean) method is called, it visits each UserRegistry bean in
the 'chain' of application contexts, managed by a ChildApplicationContextManager, and compares its
timestamped user and group information with the local users and groups last retrieved from the same source. Any
updates and additions made to those users and groups are applied to the local copies. The ordering of each
UserRegistry in the chain determines its precedence when it comes to user and group name collisions. The
JobLockService is used to ensure that in a cluster, no two nodes actually run a synchronize at the same time.
The force argument determines whether a complete or partial set of information is queried from the
UserRegistry. When true then all users and groups are queried. With this complete set of
information, the synchronizer is able to identify which users and groups have been deleted, so it will delete users
and groups as well as update and create them. Since processing all users and groups may be fairly time consuming, it
is recommended this mode is only used by a background scheduled synchronization job. When the argument is
false then only those users and groups modified since the most recent modification date of all the
objects last queried from the same UserRegistry are retrieved. In this mode, local users and groups are
created and updated, but not deleted (except where a name collision with a lower priority UserRegistry is
detected). This 'differential' mode is much faster, and by default is triggered on subsystem startup and also by
createMissingPerson(String) when a user is successfully authenticated who doesn't yet have a local person
object in Alfresco. This should mean that new users and their group information are pulled over from LDAP servers as
and when required.
- Author:
- dward
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final QNameThe name of the lock used to ensure that a synchronize does not run on more than one node at the same time.static final StringThe path in the attribute service below which we persist attributes.Fields inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateMissingPerson(String userName) Creates a person object for a successfully authenticated user who does not yet have a person object, if allowed to by configuration.The last error message or null if last sync completed without errorGet the serveridgetPersonMappedProperties(String username) Gets the set of property names that are auto-mapped for the user with the given user name.Get the end date/time of the last synchronizationgetSynchronizationLastError(String zoneId) Get the last error message from synchronizing this zoneGet the date/time that the last group update completedGet the date/time that the last user/person update completedgetSynchronizationStatus(String zoneId) Get the synchronization statusgetSynchronizationSummary(String zoneId) Get the synchronization summary message for the specified zoneGet the start date/time of the last synchronizationvoidinit()voidonApplicationEvent(org.springframework.context.ApplicationEvent event) protected voidonBootstrap(org.springframework.context.ApplicationEvent event) protected voidonShutdown(org.springframework.context.ApplicationEvent event) voidsetAllowDeletions(boolean allowDeletions) Controls how deleted users and groups are handled.voidsetApplicationContextManager(ChildApplicationContextManager applicationContextManager) Sets the application context manager.voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAttributeService(AttributeService attributeService) Sets the attribute service.voidsetAuthorityService(AuthorityService authorityService) Sets the authority service.voidsetAutoCreatePeopleOnLogin(boolean autoCreatePeopleOnLogin) Controls whether we auto create a missing person on log in.voidsetExternalUserControl(String externalUserControl) voidsetExternalUserControlSubsystemName(String externalUserControlSubsystemName) voidsetJobLockService(JobLockService jobLockService) Sets the job lock service.voidsetLoggingInterval(int loggingInterval) Sets the number of entries to process before reporting progress.voidsetNameChecker(NameChecker nameChecker) Sets name checkervoidsetPersonService(PersonService personService) Sets the person service.voidsetSourceBeanName(String sourceBeanName) Sets the name used to look up aUserRegistrybean in each child application context.voidsetSyncDelete(boolean syncDelete) Controls whether to query for users and groups that have been deleted in LDAP.voidsetSyncOnStartup(boolean syncOnStartup) Controls whether we trigger a differential sync when the subsystem starts up.voidsetSyncWhenMissingPeopleLogIn(boolean syncWhenMissingPeopleLogIn) Controls whether we trigger a differential sync when missing people log in.voidsetSysAdminParams(SysAdminParams sysAdminParams) voidsetTransactionService(TransactionService transactionService) Sets the transaction service.voidsetWorkerThreads(int workerThreads) Sets the number of worker threads.voidsynchronize(boolean forceUpdate, boolean isFullSync) Retrieves timestamped user and group information from configured external sources and compares it with the local users and groups last retrieved from the same sources.testSynchronize(String authenticatorName) runs read only diagnostic tests upon the specified user directory, does not actually do any synchronizationMethods inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean
getApplicationContext, setApplicationContext
-
Field Details
-
LOCK_QNAME
The name of the lock used to ensure that a synchronize does not run on more than one node at the same time. -
ROOT_ATTRIBUTE_PATH
The path in the attribute service below which we persist attributes.- See Also:
-
-
Constructor Details
-
ChainingUserRegistrySynchronizer
public ChainingUserRegistrySynchronizer()
-
-
Method Details
-
init
public void init() -
setExternalUserControl
-
setExternalUserControlSubsystemName
-
setNameChecker
Sets name checker -
setApplicationContextManager
Sets the application context manager.- Parameters:
applicationContextManager- the applicationContextManager to set
-
setSourceBeanName
Sets the name used to look up aUserRegistrybean in each child application context.- Parameters:
sourceBeanName- the bean name
-
setAuthorityService
Sets the authority service.- Parameters:
authorityService- the new authority service
-
setPersonService
Sets the person service.- Parameters:
personService- the new person service
-
setAttributeService
Sets the attribute service.- Parameters:
attributeService- the new attribute service
-
setTransactionService
Sets the transaction service.- Parameters:
transactionService- the transaction service
-
setJobLockService
Sets the job lock service.- Parameters:
jobLockService- the job lock service
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setAutoCreatePeopleOnLogin
public void setAutoCreatePeopleOnLogin(boolean autoCreatePeopleOnLogin) Controls whether we auto create a missing person on log in.- Parameters:
autoCreatePeopleOnLogin-trueif we should auto create a missing person on log in
-
setSyncWhenMissingPeopleLogIn
public void setSyncWhenMissingPeopleLogIn(boolean syncWhenMissingPeopleLogIn) Controls whether we trigger a differential sync when missing people log in.- Parameters:
syncWhenMissingPeopleLogIn-trueif we should trigger a sync when missing people log in
-
setSyncOnStartup
public void setSyncOnStartup(boolean syncOnStartup) Controls whether we trigger a differential sync when the subsystem starts up.- Parameters:
syncOnStartup-trueif we should trigger a sync on startup
-
setLoggingInterval
public void setLoggingInterval(int loggingInterval) Sets the number of entries to process before reporting progress.- Parameters:
loggingInterval- the number of entries to process before reporting progress or zero to disable progress reporting.
-
setWorkerThreads
public void setWorkerThreads(int workerThreads) Sets the number of worker threads.- Parameters:
workerThreads- the number of worker threads
-
setAllowDeletions
public void setAllowDeletions(boolean allowDeletions) Controls how deleted users and groups are handled. By default is set to true.- Parameters:
allowDeletions- If true the entries are deleted from alfresco. If false then they are unlinked from their LDAP authentication zone but remain within alfresco.
-
setSyncDelete
public void setSyncDelete(boolean syncDelete) Controls whether to query for users and groups that have been deleted in LDAP. For large LDAP directories the delete query is expensive and time consuming, needing to read the entire LDAP directory. By default is set to true.- Parameters:
syncDelete- If false then LDAP sync does not even attempt to search for deleted users.
-
testSynchronize
Description copied from interface:TestableChainingUserRegistrySynchronizerruns read only diagnostic tests upon the specified user directory, does not actually do any synchronization- Specified by:
testSynchronizein interfaceTestableChainingUserRegistrySynchronizer- Parameters:
authenticatorName- name of the user directory to test- Returns:
- diagnostic information @see org.alfresco.repo.security.sync.SynchronizeDiagnostic
-
synchronize
public void synchronize(boolean forceUpdate, boolean isFullSync) Description copied from interface:UserRegistrySynchronizerRetrieves timestamped user and group information from configured external sources and compares it with the local users and groups last retrieved from the same sources. Any updates and additions made to those users and groups are applied to the local Alfresco copies. This process is always run in different transactions and threads.- Specified by:
synchronizein interfaceUserRegistrySynchronizer- Parameters:
forceUpdate- Should the complete set of users and groups be updated / created locally or just those known to have changed since the last sync? Whentruethen all users and groups are queried from the user registry and updated locally. Whenfalsethen each source is only queried for those users and groups modified since the most recent modification date of all the objects last queried from that same source.isFullSync- Should a complete set of user and group IDs be queried from the user registries in order to determine deletions? This parameter is independent offorceas a separate query is run to process updates.
-
getPersonMappedProperties
Description copied from interface:UserRegistrySynchronizerGets the set of property names that are auto-mapped for the user with the given user name. These should remain read-only for the user in the UI.- Specified by:
getPersonMappedPropertiesin interfaceUserRegistrySynchronizer- Returns:
- the person mapped properties
-
createMissingPerson
Description copied from interface:UserRegistrySynchronizerCreates a person object for a successfully authenticated user who does not yet have a person object, if allowed to by configuration. Depending on configuration, may trigger a partial synchronize and/or create a new person with default settings.- Specified by:
createMissingPersonin interfaceUserRegistrySynchronizer- Parameters:
userName- the user name- Returns:
- true, if a person is created
-
onBootstrap
protected void onBootstrap(org.springframework.context.ApplicationEvent event) - Specified by:
onBootstrapin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
onShutdown
protected void onShutdown(org.springframework.context.ApplicationEvent event) - Specified by:
onShutdownin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
getSyncStartTime
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the start date/time of the last synchronization- Specified by:
getSyncStartTimein interfaceChainingUserRegistrySynchronizerStatus- Returns:
- the date/time or null
-
getSyncEndTime
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the end date/time of the last synchronization- Specified by:
getSyncEndTimein interfaceChainingUserRegistrySynchronizerStatus- Returns:
- the date/time or null
-
getLastErrorMessage
Description copied from interface:ChainingUserRegistrySynchronizerStatusThe last error message or null if last sync completed without error- Specified by:
getLastErrorMessagein interfaceChainingUserRegistrySynchronizerStatus- Returns:
- the last error message or null
-
getLastRunOnServer
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the serverid- Specified by:
getLastRunOnServerin interfaceChainingUserRegistrySynchronizerStatus- Returns:
- the server id of the sever that last ran sync
-
getSynchronizationStatus
- Specified by:
getSynchronizationStatusin interfaceChainingUserRegistrySynchronizerStatus- Returns:
- String
-
getSynchronizationStatus
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the synchronization status- Specified by:
getSynchronizationStatusin interfaceChainingUserRegistrySynchronizerStatus- Parameters:
zoneId- - zone id- Returns:
- the status
-
getSynchronizationLastUserUpdateTime
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the date/time that the last user/person update completed- Specified by:
getSynchronizationLastUserUpdateTimein interfaceChainingUserRegistrySynchronizerStatus- Parameters:
id- String- Returns:
- date or null if sync has never completed
-
getSynchronizationLastGroupUpdateTime
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the date/time that the last group update completed- Specified by:
getSynchronizationLastGroupUpdateTimein interfaceChainingUserRegistrySynchronizerStatus- Parameters:
id- String- Returns:
- date or null if sync has never completed
-
getSynchronizationLastError
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the last error message from synchronizing this zone- Specified by:
getSynchronizationLastErrorin interfaceChainingUserRegistrySynchronizerStatus- Parameters:
zoneId- the zone- Returns:
- the last error message or null if the last sync did not have an error
-
getSynchronizationSummary
Description copied from interface:ChainingUserRegistrySynchronizerStatusGet the synchronization summary message for the specified zone- Specified by:
getSynchronizationSummaryin interfaceChainingUserRegistrySynchronizerStatus- Parameters:
zoneId- the zone- Returns:
- the summary or null
-
setSysAdminParams
-
getSysAdminParams
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener- Overrides:
onApplicationEventin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-