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
DefaultSyncHandler
implements an sync handler that synchronizes users and groups from an external identity provider with the repository users.Please refer to
DefaultSyncConfigImpl
for 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 void
activate(@NotNull org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)
@NotNull SyncContext
createContext(@NotNull ExternalIdentityProvider idp, @NotNull UserManager userManager, @NotNull ValueFactory valueFactory)
Initializes a sync context which is used to start the sync operations.void
deactivate()
SyncedIdentity
findIdentity(@NotNull UserManager userManager, @NotNull String id)
Tries to find the identity with the given authorizable id or name.@NotNull AutoMembershipConfig
getAutoMembershipConfig()
Returns theAutoMembershipConfig
defined with theSyncHandler
implementing this interface.@NotNull String
getName()
Returns the name of this sync handler.@NotNull Iterator<SyncedIdentity>
listIdentities(@NotNull UserManager userManager)
Lists all externally synced identities.boolean
requiresSync(@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:
getName
in 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:
createContext
in 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:
findIdentity
in 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:
requiresSync
in interfaceSyncHandler
- Parameters:
identity
- the identity to check- Returns:
true
if the identity requires synchronization.
-
listIdentities
@NotNull public @NotNull Iterator<SyncedIdentity> listIdentities(@NotNull @NotNull UserManager userManager) throws RepositoryException
Lists all externally synced identities.- Specified by:
listIdentities
in 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:AutoMembershipAware
Returns theAutoMembershipConfig
defined with theSyncHandler
implementing this interface.- Specified by:
getAutoMembershipConfig
in interfaceAutoMembershipAware
- Returns:
- an instance of
AutoMembershipConfig
-
-