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;
}
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());
}
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());
}
Aggregations