use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.
the class DefaultSyncHandlerTest method testRequiresSyncAfterCreate.
@Test
public void testRequiresSyncAfterCreate() throws Exception {
login(new SimpleCredentials(USER_ID, new char[0])).close();
root.refresh();
SyncedIdentity id = syncHandler.findIdentity(userManager, USER_ID);
assertNotNull("Known authorizable should exist", id);
assertFalse("Freshly synced id should not require sync", syncHandler.requiresSync(id));
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testSyncByForeignGroupId.
@Test
public void testSyncByForeignGroupId() throws Exception {
SyncResult result = syncCtx.sync(createTestGroup().getID());
assertEquals(SyncResult.Status.FOREIGN, result.getStatus());
SyncedIdentity si = result.getIdentity();
assertNotNull(si);
assertNull(si.getExternalIdRef());
assertTrue(si.isGroup());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.
the class DefaultSyncHandlerTest method testRequiresSyncGroup.
@Test
public void testRequiresSyncGroup() throws Exception {
sync("c", true);
SyncedIdentity si = syncHandler.findIdentity(userManager, "c");
assertNotNull(si);
assertTrue(si.isGroup());
assertFalse(syncHandler.requiresSync(si));
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.
the class DefaultSyncHandlerTest method testFindExternalIdentity.
@Test
public void testFindExternalIdentity() throws Exception {
login(new SimpleCredentials(USER_ID, new char[0])).close();
root.refresh();
SyncedIdentity id = syncHandler.findIdentity(userManager, USER_ID);
assertNotNull("known authorizable should exist", id);
ExternalIdentityRef ref = id.getExternalIdRef();
assertNotNull(ref);
assertEquals("external user should have correct external ref.idp", idp.getName(), ref.getProviderName());
assertEquals("external user should have correct external ref.id", USER_ID, id.getExternalIdRef().getId());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testCreateSyncedIdentityLocalGroup.
@Test
public void testCreateSyncedIdentityLocalGroup() throws Exception {
Group gr = createTestGroup();
SyncedIdentity si = DefaultSyncContext.createSyncedIdentity(gr);
assertNotNull(si);
assertEquals(gr.getID(), si.getId());
assertNull(si.getExternalIdRef());
assertTrue(si.isGroup());
assertEquals(-1, si.lastSynced());
}
Aggregations