public void testImpersonatingOneself() throws RepositoryException { Subject subject = createSubject(newUser); assertFalse(impersonation.allows(subject)); }
public void testRevokeImpersonatingForOneself() throws RepositoryException { Principal main = newUser.getPrincipal(); assertFalse(impersonation.revokeImpersonation(main)); }
public void testGrantImpersonatingForOneself() throws RepositoryException { Principal main = newUser.getPrincipal(); try { assertFalse(impersonation.grantImpersonation(main)); } finally { impersonation.revokeImpersonation(main); } }
public void testUnknownCannotImpersonate() throws RepositoryException { Principal test = getTestPrincipal(); Subject subject = createSubject(test); assertFalse("An unknown principal should not be allowed to impersonate.", impersonation.allows(subject)); }
public void testCannotRevokeImpersonationForAdministrator() throws RepositoryException, NotExecutableException { User admin = getTestUser(superuser); assertFalse(impersonation.revokeImpersonation(admin.getPrincipal())); }
public void testGrantImpersonationUnknownUser() throws RepositoryException, NotExecutableException { Principal test = getTestPrincipal(); try { assertFalse("Granting impersonation to an unknown principal should not be successful.", impersonation.grantImpersonation(test)); } finally { impersonation.revokeImpersonation(test); save(superuser); } }
public void testImpersonateGroup() throws RepositoryException, NotExecutableException { Session s = getHelper().getReadOnlySession(); try { Principal group = getTestGroup(s).getPrincipal(); Subject subject = createSubject(group); assertFalse("An group principal should not be allowed to impersonate.", impersonation.allows(subject)); } finally { s.logout(); } }
public void testCannotGrantImpersonationForAdministrator() throws RepositoryException, NotExecutableException { User admin = getTestUser(superuser); try { assertFalse(impersonation.grantImpersonation(admin.getPrincipal())); } finally { impersonation.revokeImpersonation(admin.getPrincipal()); } }
public void testGrantImpersonationToGroupPrincipal() throws RepositoryException, NotExecutableException { Session s = getHelper().getReadOnlySession(); try { Principal group = getTestGroup(s).getPrincipal(); try { assertFalse("Granting impersonation to a Group should not be successful.", impersonation.grantImpersonation(group)); } finally { impersonation.revokeImpersonation(group); save(superuser); } } finally { s.logout(); } }
public void testRevokeImpersonationTwice() throws RepositoryException, NotExecutableException { User u = null; Principal test = getTestPrincipal(); try { u = userMgr.createUser(test.getName(), buildPassword(test)); save(superuser); impersonation.grantImpersonation(test); save(superuser); impersonation.revokeImpersonation(test); save(superuser); // try again assertFalse("Revoking impersonation twice should not succeed.", impersonation.revokeImpersonation(test)); } finally { if (u != null) { u.remove(); } } }
public void testGrantImpersonationTwice() throws RepositoryException, NotExecutableException { Principal test = getTestPrincipal(); User u = null; try { u = userMgr.createUser(test.getName(), buildPassword(test)); save(superuser); impersonation.grantImpersonation(test); save(superuser); // try again assertFalse("Granting impersonation twice should not succeed.", impersonation.grantImpersonation(test)); } finally { impersonation.revokeImpersonation(test); if (u != null) { u.remove(); } save(superuser); } }