use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class CugAccessControlManagerTest method testSetInvalidPolicy.
@Test
public void testSetInvalidPolicy() throws Exception {
List<AccessControlPolicy> invalidPolicies = ImmutableList.of(new AccessControlPolicy() {
}, new NamedAccessControlPolicy() {
public String getName() {
return "name";
}
}, InvalidCug.INSTANCE);
for (AccessControlPolicy policy : invalidPolicies) {
try {
cugAccessControlManager.setPolicy(SUPPORTED_PATH, policy);
fail("Invalid cug policy must be detected.");
} catch (AccessControlException e) {
// success
}
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class AdminPrincipalsBaseTest method testAdminAuthInfoPrincipals.
@Test
public void testAdminAuthInfoPrincipals() throws Exception {
try {
for (Principal p : adminSession.getAuthInfo().getPrincipals()) {
if (p instanceof AdminPrincipal) {
boolean success = acl.addAccessControlEntry(p, privilegesFromNames(PrivilegeConstants.JCR_READ));
assertResult(success);
}
}
} catch (AccessControlException e) {
assertException();
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class ACLTest method testReorderInvalidEntries.
@Test
public void testReorderInvalidEntries() throws Exception {
Privilege[] read = privilegesFromNames(JCR_READ, JCR_READ_ACCESS_CONTROL);
Privilege[] write = privilegesFromNames(JCR_WRITE);
acl.addAccessControlEntry(testPrincipal, read);
acl.addAccessControlEntry(EveryonePrincipal.getInstance(), write);
AccessControlEntry invalid = createEntry(testPrincipal, false, null, JCR_WRITE);
try {
acl.orderBefore(invalid, acl.getEntries().get(0));
fail("src entry not contained in list -> reorder should fail.");
} catch (AccessControlException e) {
// success
}
try {
acl.orderBefore(acl.getEntries().get(0), invalid);
fail("dest entry not contained in list -> reorder should fail.");
} catch (AccessControlException e) {
// success
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class ACLTest method testUnknownPrincipal.
@Test
public void testUnknownPrincipal() throws Exception {
Principal unknownPrincipal = new InvalidTestPrincipal("unknown");
try {
acl.addAccessControlEntry(unknownPrincipal, privilegesFromNames(JCR_READ));
fail("Adding an ACE with an unknown principal should fail");
} catch (AccessControlException e) {
// success
}
}
use of javax.jcr.security.AccessControlException in project jackrabbit-oak by apache.
the class ACLTest method testEmptyPrincipal.
@Test
public void testEmptyPrincipal() throws Exception {
try {
acl.addAccessControlEntry(new PrincipalImpl(""), privilegesFromNames(JCR_READ));
fail("Adding an ACE with empty-named principal should fail");
} catch (AccessControlException e) {
// success
}
}
Aggregations