Search in sources :

Example 6 with SyncContext

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext in project jackrabbit-oak by apache.

the class AbstractJmxTest method sync.

SyncResult sync(@Nonnull ExternalIdentity externalIdentity, @Nonnull ExternalIdentityProvider idp) throws Exception {
    SyncContext ctx = new DefaultSyncContext(syncConfig, idp, getUserManager(root), getValueFactory(root));
    SyncResult res = ctx.sync(externalIdentity);
    root.commit();
    return res;
}
Also used : DefaultSyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext) SyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext) DefaultSyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext) SyncResult(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult)

Example 7 with SyncContext

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext in project jackrabbit-oak by apache.

the class DynamicSyncContextTest method testSyncExternalGroupExisting.

@Test
public void testSyncExternalGroupExisting() throws Exception {
    // create an external external group that already has been synced into the repo
    ExternalGroup externalGroup = idp.listGroups().next();
    SyncContext ctx = new DefaultSyncContext(syncConfig, idp, userManager, valueFactory);
    ctx.sync(externalGroup);
    ctx.close();
    // synchronizing using DynamicSyncContext must update the existing group
    syncContext.setForceGroupSync(true);
    SyncResult result = syncContext.sync(externalGroup);
    assertSame(SyncResult.Status.UPDATE, result.getStatus());
}
Also used : DefaultSyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext) ExternalGroup(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup) SyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext) DefaultSyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext) SyncResult(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 8 with SyncContext

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext in project jackrabbit-oak by apache.

the class DynamicSyncContextTest method testSyncMembershipForExternalGroup.

@Test
public void testSyncMembershipForExternalGroup() throws Exception {
    // a group that has declaredGroups
    ExternalGroup externalGroup = idp.getGroup("a");
    SyncContext ctx = new DefaultSyncContext(syncConfig, idp, userManager, valueFactory);
    ctx.sync(externalGroup);
    ctx.close();
    r.commit();
    Authorizable gr = userManager.getAuthorizable(externalGroup.getId());
    syncContext.syncMembership(externalGroup, gr, 1);
    assertFalse(gr.hasProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES));
    assertFalse(r.hasPendingChanges());
}
Also used : DefaultSyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext) ExternalGroup(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup) Authorizable(org.apache.jackrabbit.api.security.user.Authorizable) SyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext) DefaultSyncContext(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Aggregations

SyncContext (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext)8 DefaultSyncContext (org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext)6 SyncResult (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult)4 Root (org.apache.jackrabbit.oak.api.Root)3 Test (org.junit.Test)3 UserManager (org.apache.jackrabbit.api.security.user.UserManager)2 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)2 DebugTimer (org.apache.jackrabbit.oak.commons.DebugTimer)2 ValueFactoryImpl (org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl)2 AbstractExternalAuthTest (org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest)2 ExternalGroup (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup)2 SyncException (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException)2 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)1 ExternalIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity)1 DynamicSyncContext (org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DynamicSyncContext)1