Class DefaultSyncHandler
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler
-
- All Implemented Interfaces:
AutoMembershipAware,SyncHandler
public class DefaultSyncHandler extends Object implements SyncHandler, AutoMembershipAware
DefaultSyncHandlerimplements an sync handler that synchronizes users and groups from an external identity provider with the repository users.Please refer to
DefaultSyncConfigImplfor configuration options.
-
-
Constructor Summary
Constructors Constructor Description DefaultSyncHandler()Default constructor for OSGiDefaultSyncHandler(DefaultSyncConfig config)Constructor for non-OSGi cases.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(@NotNull org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)@NotNull SyncContextcreateContext(@NotNull ExternalIdentityProvider idp, @NotNull UserManager userManager, @NotNull ValueFactory valueFactory)Initializes a sync context which is used to start the sync operations.voiddeactivate()SyncedIdentityfindIdentity(@NotNull UserManager userManager, @NotNull String id)Tries to find the identity with the given authorizable id or name.@NotNull AutoMembershipConfiggetAutoMembershipConfig()Returns theAutoMembershipConfigdefined with theSyncHandlerimplementing this interface.@NotNull StringgetName()Returns the name of this sync handler.@NotNull Iterator<SyncedIdentity>listIdentities(@NotNull UserManager userManager)Lists all externally synced identities.booleanrequiresSync(@NotNull SyncedIdentity identity)Checks if the identity requires sync based on the configuration, type and last sync time.
-
-
-
Constructor Detail
-
DefaultSyncHandler
public DefaultSyncHandler()
Default constructor for OSGi
-
DefaultSyncHandler
public DefaultSyncHandler(DefaultSyncConfig config)
Constructor for non-OSGi cases.- Parameters:
config- the configuration
-
-
Method Detail
-
activate
public void activate(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)
-
deactivate
public void deactivate()
-
getName
@NotNull public @NotNull String getName()
Returns the name of this sync handler.- Specified by:
getNamein interfaceSyncHandler- Returns:
- sync handler name
-
createContext
@NotNull public @NotNull SyncContext createContext(@NotNull @NotNull ExternalIdentityProvider idp, @NotNull @NotNull UserManager userManager, @NotNull @NotNull ValueFactory valueFactory)
Initializes a sync context which is used to start the sync operations.- Specified by:
createContextin interfaceSyncHandler- Parameters:
idp- the external identity provider used for syncinguserManager- user manager for managing authorizablesvalueFactory- the value factory to create values- Returns:
- the sync context
-
findIdentity
public SyncedIdentity findIdentity(@NotNull @NotNull UserManager userManager, @NotNull @NotNull String id) throws RepositoryException
Tries to find the identity with the given authorizable id or name.- Specified by:
findIdentityin interfaceSyncHandler- Parameters:
userManager- the user managerid- the id or name of the authorizable- Returns:
- a synced identity object or
null - Throws:
RepositoryException- if an error occurs
-
requiresSync
public boolean requiresSync(@NotNull @NotNull SyncedIdentity identity)Checks if the identity requires sync based on the configuration, type and last sync time.- Specified by:
requiresSyncin interfaceSyncHandler- Parameters:
identity- the identity to check- Returns:
trueif the identity requires synchronization.
-
listIdentities
@NotNull public @NotNull Iterator<SyncedIdentity> listIdentities(@NotNull @NotNull UserManager userManager) throws RepositoryException
Lists all externally synced identities.- Specified by:
listIdentitiesin interfaceSyncHandler- Parameters:
userManager- the user manager- Returns:
- an iterator over all authorizable that are externally synced.
- Throws:
RepositoryException- if an error occurs
-
getAutoMembershipConfig
@NotNull public @NotNull AutoMembershipConfig getAutoMembershipConfig()
Description copied from interface:AutoMembershipAwareReturns theAutoMembershipConfigdefined with theSyncHandlerimplementing this interface.- Specified by:
getAutoMembershipConfigin interfaceAutoMembershipAware- Returns:
- an instance of
AutoMembershipConfig
-
-