use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class DefaultSyncHandlerTest method sync.
private void sync(@Nonnull String id, boolean isGroup) throws Exception {
SyncContext ctx = syncHandler.createContext(idp, userManager, getValueFactory());
ExternalIdentity exIdentity = (isGroup) ? idp.getGroup(id) : idp.getUser(id);
assertNotNull(exIdentity);
SyncResult res = ctx.sync(exIdentity);
assertSame(SyncResult.Status.ADD, res.getStatus());
root.commit();
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testSyncUserById.
@Test
public void testSyncUserById() throws Exception {
ExternalIdentity externalId = idp.listUsers().next();
// no initial sync -> sync-by-id doesn't succeed
SyncResult result = syncCtx.sync(externalId.getId());
assertEquals(SyncResult.Status.NO_SUCH_AUTHORIZABLE, result.getStatus());
// force sync
syncCtx.sync(externalId);
// try again
syncCtx.setForceUserSync(true);
result = syncCtx.sync(externalId.getId());
assertEquals(SyncResult.Status.UPDATE, result.getStatus());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testGetAuthorizableUserWrongType.
@Test(expected = SyncException.class)
public void testGetAuthorizableUserWrongType() throws Exception {
ExternalIdentity extUser = idp.listUsers().next();
sync(extUser);
syncCtx.getAuthorizable(extUser, Group.class);
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testGetAuthorizableUser.
@Test
public void testGetAuthorizableUser() throws Exception {
ExternalIdentity extUser = idp.listUsers().next();
User user = syncCtx.getAuthorizable(extUser, User.class);
assertNull(user);
sync(extUser);
user = syncCtx.getAuthorizable(extUser, User.class);
assertNotNull(user);
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testIsSameIDPSyncedGroup.
@Test
public void testIsSameIDPSyncedGroup() throws Exception {
ExternalIdentity externalGroup = idp.listGroups().next();
sync(externalGroup);
assertTrue(syncCtx.isSameIDP(userManager.getAuthorizable(externalGroup.getId())));
}
Aggregations