Class DynamicSyncContext

  • All Implemented Interfaces:
    SyncContext

    public class DynamicSyncContext
    extends DefaultSyncContext
    Extension of the DefaultSyncContext that doesn't synchronize group membership of new external users into the user management of the repository. Instead it will only synchronize the principal names up to the configured depths. In combination with the a dedicated PrincipalConfiguration this allows to benefit from the repository's authorization model (which is solely based on principals) i.e. full compatibility with the default approach without the complication of synchronizing user management information into the repository, when user management is effectively take care of by the third party system. With the DefaultSyncHandler this feature can be turned on using DefaultSyncConfig.User.setDynamicMembership(boolean) Note: users and groups that have been synchronized before the dynamic membership feature has been enabled will continue to be synchronized in the default way and this context doesn't take effect.
    Since:
    Oak 1.5.3
    • Constructor Detail

      • DynamicSyncContext

        public DynamicSyncContext​(@NotNull
                                  @NotNull DefaultSyncConfig config,
                                  @NotNull
                                  @NotNull ExternalIdentityProvider idp,
                                  @NotNull
                                  @NotNull org.apache.jackrabbit.api.security.user.UserManager userManager,
                                  @NotNull
                                  @NotNull javax.jcr.ValueFactory valueFactory)
    • Method Detail

      • syncMembership

        protected void syncMembership​(@NotNull
                                      @NotNull ExternalIdentity external,
                                      @NotNull
                                      @NotNull org.apache.jackrabbit.api.security.user.Authorizable auth,
                                      long depth)
                               throws javax.jcr.RepositoryException
        Description copied from class: DefaultSyncContext
        Recursively sync the memberships of an authorizable up-to the specified depth. If the given depth is equal or less than 0, no syncing is performed.
        Overrides:
        syncMembership in class DefaultSyncContext
        Parameters:
        external - the external identity
        auth - the authorizable
        depth - recursion depth.
        Throws:
        javax.jcr.RepositoryException
      • applyMembership

        protected void applyMembership​(@NotNull
                                       @NotNull org.apache.jackrabbit.api.security.user.Authorizable member,
                                       @NotNull
                                       @NotNull Set<String> groups)
                                throws javax.jcr.RepositoryException
        Description copied from class: DefaultSyncContext
        Ensures that the given authorizable is member of the specific groups. Note that it does not create groups if missing, nor remove memberships of groups not in the given set.
        Overrides:
        applyMembership in class DefaultSyncContext
        Parameters:
        member - the authorizable
        groups - set of groups.
        Throws:
        javax.jcr.RepositoryException