use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class PrincipalProviderAutoMembershipTest method testGetGroupPrincipals.
@Test
public void testGetGroupPrincipals() throws Exception {
Set<Principal> expected = getExpectedGroupPrincipals(USER_ID);
Authorizable user = getUserManager(root).getAuthorizable(USER_ID);
Set<java.security.acl.Group> result = principalProvider.getGroupMembership(user.getPrincipal());
assertTrue(result.contains(autoMembershipGroup.getPrincipal()));
assertEquals(expected, result);
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipExternalUser2.
@Test
public void testGetGroupMembershipExternalUser2() throws Exception {
Authorizable user = getUserManager(root).getAuthorizable(USER_ID);
assertNotNull(user);
Set<Principal> expected = getExpectedGroupPrincipals(USER_ID);
// same as in test before even if the principal is not a tree-based-principal
Set<? extends Principal> principals = principalProvider.getGroupMembership(new PrincipalImpl(user.getPrincipal().getName()));
assertEquals(expected, principals);
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipExternalGroup.
@Test
public void testGetGroupMembershipExternalGroup() throws Exception {
Authorizable group = getUserManager(root).getAuthorizable("secondGroup");
assertNotNull(group);
Set<? extends Principal> principals = principalProvider.getGroupMembership(group.getPrincipal());
assertTrue(principals.isEmpty());
// same if the principal is not marked as 'java.security.acl.Group' and not tree-based-principal
principals = principalProvider.getGroupMembership(new PrincipalImpl(group.getPrincipal().getName()));
assertTrue(principals.isEmpty());
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipDefaultSync.
@Test
public void testGetGroupMembershipDefaultSync() throws Exception {
// synchronized by default sync-context => no 'dynamic' group principals
Authorizable user = getUserManager(root).getAuthorizable(TestIdentityProvider.ID_SECOND_USER);
assertNotNull(user);
Set<? extends Principal> principals = principalProvider.getGroupMembership(user.getPrincipal());
assertTrue(principals.isEmpty());
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipDefaultSync2.
@Test
public void testGetGroupMembershipDefaultSync2() throws Exception {
// synchronized by default sync-context => no 'dynamic' group principals
Authorizable user = getUserManager(root).getAuthorizable(TestIdentityProvider.ID_SECOND_USER);
assertNotNull(user);
// same as in test before even if the principal is not a tree-based-principal
Set<? extends Principal> principals = principalProvider.getGroupMembership(new PrincipalImpl(user.getPrincipal().getName()));
assertTrue(principals.isEmpty());
}
Aggregations