use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testInitialSyncExternalGroup.
@Test
public void testInitialSyncExternalGroup() throws Exception {
ExternalGroup externalGroup = idp.getGroup("a");
String[] externalId = new String[] { externalGroup.getExternalId().getString() };
String[] result = syncMBean.syncExternalUsers(externalId);
assertResultMessages(result, "a", "add");
UserManager userManager = getUserManager();
Group aGroup = userManager.getAuthorizable(externalGroup.getId(), Group.class);
assertNotNull(aGroup);
// membership of groups are not synced (unless imposed by user-sync with membership depth)
for (ExternalIdentityRef groupRef : externalGroup.getDeclaredGroups()) {
assertNull(userManager.getAuthorizable(groupRef.getId()));
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup in project jackrabbit-oak by apache.
the class LdapProviderTest method testGetGroupByName.
@Test
public void testGetGroupByName() throws Exception {
ExternalGroup group = idp.getGroup(TEST_GROUP1_NAME);
assertNotNull("Group 1 must exist", group);
assertEquals("Group Ref", TEST_GROUP1_DN, group.getExternalId().getId());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup in project jackrabbit-oak by apache.
the class LdapProviderTest method testGetGroupByRef.
@Test
public void testGetGroupByRef() throws Exception {
ExternalIdentityRef ref = new ExternalIdentityRef(TEST_GROUP1_DN, IDP_NAME);
ExternalIdentity id = idp.getIdentity(ref);
assertTrue("Group instance", id instanceof ExternalGroup);
assertEquals("Group Name", TEST_GROUP1_NAME, id.getId());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testSyncExternalToForeignLocalGroup.
@Test
public void testSyncExternalToForeignLocalGroup() throws Exception {
ExternalGroup external = idp.listGroups().next();
syncCtx.sync(external);
Group gr = userManager.getAuthorizable(external.getId(), Group.class);
setExternalID(gr, "differentIDP");
SyncResult result = syncCtx.sync(external);
assertEquals(SyncResult.Status.FOREIGN, result.getStatus());
SyncedIdentity si = result.getIdentity();
assertNotNull(si);
assertEquals(external.getExternalId(), si.getExternalIdRef());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup in project jackrabbit-oak by apache.
the class DefaultSyncContextTest method testSyncExternalToExistingLocalGroup.
@Test
public void testSyncExternalToExistingLocalGroup() throws Exception {
ExternalGroup external = idp.listGroups().next();
syncCtx.sync(external);
Group gr = userManager.getAuthorizable(external.getId(), Group.class);
gr.removeProperty(ExternalIdentityConstants.REP_EXTERNAL_ID);
SyncResult result = syncCtx.sync(external);
assertEquals(SyncResult.Status.FOREIGN, result.getStatus());
SyncedIdentity si = result.getIdentity();
assertNotNull(si);
assertEquals(external.getExternalId(), si.getExternalIdRef());
}
Aggregations