use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method collectExpectedPrincipals.
private void collectExpectedPrincipals(Set<Principal> grPrincipals, @Nonnull Iterable<ExternalIdentityRef> declaredGroups, long depth) throws Exception {
if (depth <= 0) {
return;
}
for (ExternalIdentityRef ref : declaredGroups) {
ExternalIdentity ei = idp.getIdentity(ref);
grPrincipals.add(new PrincipalImpl(ei.getPrincipalName()));
collectExpectedPrincipals(grPrincipals, ei.getDeclaredGroups(), depth - 1);
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testSyncAllUsers.
@Test
public void testSyncAllUsers() throws Exception {
// first sync external users into the repo
syncMBean.syncAllExternalUsers();
// verify effect of syncAllUsers
String[] result = syncMBean.syncAllUsers(false);
Map<String, String> expected = getExpectedUserResult("upd", true);
assertResultMessages(result, expected);
UserManager userManager = getUserManager();
for (String id : expected.keySet()) {
ExternalIdentity ei = idp.getUser(id);
if (ei == null) {
ei = idp.getGroup(id);
}
assertSync(ei, userManager);
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testSyncAllExternalUsersAgain.
@Test
public void testSyncAllExternalUsersAgain() throws Exception {
syncMBean.syncAllExternalUsers();
// sync again
String[] result = syncMBean.syncAllExternalUsers();
// verify result
Map<String, String> expected = getExpectedUserResult("upd", false);
assertResultMessages(result, expected);
UserManager userManager = getUserManager();
for (String id : expected.keySet()) {
ExternalIdentity ei = idp.getUser(id);
if (ei == null) {
ei = idp.getGroup(id);
}
assertSync(ei, userManager);
}
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class LdapProviderTest method testGetUserByForeignRef.
@Test
public void testGetUserByForeignRef() throws Exception {
ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER1_DN, "foobar");
ExternalIdentity id = idp.getIdentity(ref);
assertNull("Foreign ref must be null", id);
}
use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity in project jackrabbit-oak by apache.
the class LdapProviderTest method testGetGroups2.
@Test
public void testGetGroups2() throws Exception {
ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER0_DN, IDP_NAME);
ExternalIdentity id = idp.getIdentity(ref);
assertTrue("User instance", id instanceof ExternalUser);
assertIfEquals("Groups", TEST_USER0_GROUPS, id.getDeclaredGroups());
}
Aggregations