use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetPrincipalDynamicGroup.
@Test
public void testGetPrincipalDynamicGroup() throws Exception {
for (ExternalIdentityRef ref : idp.getUser(USER_ID).getDeclaredGroups()) {
String princName = idp.getIdentity(ref).getPrincipalName();
Principal principal = principalProvider.getPrincipal(princName);
assertNotNull(principal);
assertTrue(principal instanceof java.security.acl.Group);
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DelegateeTest method testSyncThrowingExternalUserSaveError.
@Test
public void testSyncThrowingExternalUserSaveError() throws Exception {
Root r = preventRootCommit(delegatee);
;
String[] result = delegatee.syncExternalUsers(new String[] { new ExternalIdentityRef(TestIdentityProvider.ID_EXCEPTION, idp.getName()).getString() });
assertResultMessages(result, TestIdentityProvider.ID_EXCEPTION, "ERR");
assertFalse(r.hasPendingChanges());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testSyncAllUsersException.
@Test
public void testSyncAllUsersException() throws Exception {
User u = getUserManager().createUser(TestIdentityProvider.ID_EXCEPTION, null);
u.setProperty(DefaultSyncContext.REP_EXTERNAL_ID, getValueFactory().createValue(new ExternalIdentityRef(TestIdentityProvider.ID_EXCEPTION, idp.getName()).getString()));
root.commit();
String[] result = syncMBean.syncAllUsers(false);
assertResultMessages(result, TestIdentityProvider.ID_EXCEPTION, "ERR");
result = syncMBean.syncAllUsers(true);
assertResultMessages(result, TestIdentityProvider.ID_EXCEPTION, "ERR");
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DynamicSyncContextTest method testSyncForeignExternalGroup.
@Test
public void testSyncForeignExternalGroup() throws Exception {
ExternalGroup foreign = new TestIdentityProvider.ForeignExternalGroup();
SyncResult res = syncContext.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(r.hasPendingChanges());
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef in project jackrabbit-oak by apache.
the class DynamicSyncContextTest method testSyncMembershipWithChangedGroups.
@Test
public void testSyncMembershipWithChangedGroups() throws Exception {
long nesting = 1;
syncConfig.user().setMembershipNestingDepth(nesting);
ExternalUser externalUser = idp.getUser(USER_ID);
sync(externalUser, SyncResult.Status.ADD);
Authorizable a = userManager.getAuthorizable(externalUser.getId());
assertDynamicMembership(a, externalUser, nesting);
// sync user with modified membership => must be reflected
// 1. empty set of declared groups
ExternalUser mod = new TestUserWithGroupRefs(externalUser, ImmutableSet.<ExternalIdentityRef>of());
syncContext.syncMembership(mod, a, nesting);
assertDynamicMembership(a, mod, nesting);
// 2. set with different groups that defined on IDP
mod = new TestUserWithGroupRefs(externalUser, ImmutableSet.<ExternalIdentityRef>of(idp.getGroup("a").getExternalId(), idp.getGroup("aa").getExternalId(), idp.getGroup("secondGroup").getExternalId()));
syncContext.syncMembership(mod, a, nesting);
assertDynamicMembership(a, mod, nesting);
}
Aggregations