use of org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal in project jackrabbit-oak by apache.
the class CugConfigurationTest method testExcludedPrincipals.
@Test
public void testExcludedPrincipals() {
ConfigurationParameters params = ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, true, CugConstants.PARAM_CUG_SUPPORTED_PATHS, "/content");
CugConfiguration cc = createConfiguration(params);
List<Principal> excluded = ImmutableList.of(SystemPrincipal.INSTANCE, new AdminPrincipal() {
@Override
public String getName() {
return "admin";
}
}, new SystemUserPrincipal() {
@Override
public String getName() {
return "systemUser";
}
});
for (Principal p : excluded) {
Set<Principal> principals = ImmutableSet.of(p, EveryonePrincipal.getInstance());
PermissionProvider pp = cc.getPermissionProvider(root, "default", principals);
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
}
use of org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal in project jackrabbit-oak by apache.
the class SystemUserImplTest method testGetPrincipal.
@Test
public void testGetPrincipal() throws Exception {
User user = createUser(null);
assertTrue(user.getPrincipal() instanceof SystemUserPrincipal);
}
use of org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal in project jackrabbit-oak by apache.
the class CugExcludeDefaultTest method testMixedPrincipals.
@Test
public void testMixedPrincipals() {
Set<Principal> principals = new HashSet<Principal>();
principals.add(new PrincipalImpl("test"));
principals.add(new SystemUserPrincipal() {
@Override
public String getName() {
return "test";
}
});
assertTrue(exclude.isExcluded(principals));
}
use of org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal in project jackrabbit-oak by apache.
the class CugExcludeDefaultTest method testSystemUserPrincipal.
@Test
public void testSystemUserPrincipal() {
Set<Principal> principals = ImmutableSet.<Principal>of(new SystemUserPrincipal() {
@Override
public String getName() {
return "test";
}
});
assertTrue(exclude.isExcluded(principals));
}
use of org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal in project jackrabbit-oak by apache.
the class AbstractPrincipalProviderTest method testSystemUserPrincipal.
@Test
public void testSystemUserPrincipal() throws Exception {
User user = getUserManager(root).createSystemUser("testSystemUser" + UUID.randomUUID(), null);
root.commit();
try {
Principal principal = principalProvider.getPrincipal(user.getPrincipal().getName());
assertNotNull(principal);
assertTrue(principal instanceof SystemUserPrincipal);
} finally {
user.remove();
root.commit();
}
}
Aggregations