use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class LdapProviderTest method testGetMembers.
@Test
public void testGetMembers() throws Exception {
ExternalIdentityRef ref = new ExternalIdentityRef(TEST_GROUP1_DN, IDP_NAME);
ExternalIdentity id = idp.getIdentity(ref);
assertTrue("Group instance", id instanceof ExternalGroup);
ExternalGroup grp = (ExternalGroup) id;
assertIfEquals("Group members", TEST_GROUP1_MEMBERS, grp.getDeclaredMembers());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DefaultSyncHandlerTest method testListIdentitiesIgnoresLocal.
@Test
public void testListIdentitiesIgnoresLocal() throws Exception {
sync(USER_ID, false);
Iterator<SyncedIdentity> identities = syncHandler.listIdentities(userManager);
while (identities.hasNext()) {
SyncedIdentity si = identities.next();
ExternalIdentityRef ref = si.getExternalIdRef();
assertNotNull(ref);
assertNotNull(ref.getProviderName());
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DynamicSyncContextTest method assertSyncedMembership.
private static void assertSyncedMembership(@Nonnull UserManager userManager, @Nonnull Authorizable a, @Nonnull ExternalIdentity externalIdentity) throws Exception {
for (ExternalIdentityRef ref : externalIdentity.getDeclaredGroups()) {
Group gr = userManager.getAuthorizable(ref.getId(), Group.class);
assertNotNull(gr);
assertTrue(gr.isMember(a));
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testGetIdentityRefSyncGroup.
@Test
public void testGetIdentityRefSyncGroup() throws Exception {
ExternalIdentity externalGroup = idp.listGroups().next();
sync(externalGroup);
ExternalIdentityRef ref = DefaultSyncContext.getIdentityRef(userManager.getAuthorizable(externalGroup.getId()));
assertNotNull(ref);
assertEquals(externalGroup.getExternalId(), ref);
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testSyncForeignExternalGroup.
@Test
public void testSyncForeignExternalGroup() throws Exception {
ExternalIdentity foreign = new TestIdentityProvider.ForeignExternalGroup();
SyncResult res = syncCtx.sync(foreign);
assertNotNull(res);
assertSame(SyncResult.Status.FOREIGN, res.getStatus());
// expect {@code SyncedIdentity} in accordance with {@code sync(String userId)},
// where the authorizable is found to be linked to a different IDP.
SyncedIdentity si = res.getIdentity();
assertNotNull(si);
assertEquals(foreign.getId(), si.getId());
ExternalIdentityRef ref = si.getExternalIdRef();
assertNotNull(ref);
assertEquals(foreign.getExternalId(), ref);
assertTrue(si.isGroup());
assertEquals(-1, si.lastSynced());
assertFalse(root.hasPendingChanges());
}
Aggregations