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)); }
@Override protected void setUp() throws Exception { super.setUp(); Principal test = getTestPrincipal(); String pw = buildPassword(test); newUser = userMgr.createUser(test.getName(), pw); save(superuser); impersonation = newUser.getImpersonation(); }
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 testGrantImpersonation() throws RepositoryException, NotExecutableException { User u = null; Principal test = getTestPrincipal(); try { u = userMgr.createUser(test.getName(), buildPassword(test)); save(superuser); assertTrue("Admin should be allowed to edit impersonation and grant to another test-user.", impersonation.grantImpersonation(test)); } finally { impersonation.revokeImpersonation(test); if (u != null) { u.remove(); } save(superuser); } }
public void testRevokeImpersonation() throws RepositoryException, NotExecutableException { User u = null; Principal test = getTestPrincipal(); try { u = userMgr.createUser(test.getName(), buildPassword(test)); save(superuser); impersonation.grantImpersonation(test); save(superuser); assertTrue(impersonation.revokeImpersonation(test)); } finally { if (u != null) { u.remove(); } } }
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); } }