public void testReadOnlyIsntAdmin() throws NotExecutableException, RepositoryException { Session s = getHelper().getReadOnlySession(); try { User user = getTestUser(s); assertFalse(user.isAdmin()); } finally { s.logout(); } }
public void testChangePassword() throws RepositoryException, NotExecutableException { String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd"); if (oldPw == null) { // missing property throw new NotExecutableException(); } User user = getTestUser(superuser); try { user.changePassword("pw"); save(superuser); // make sure the user can login with the new pw Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), "pw".toCharArray())); s.logout(); } finally { user.changePassword(oldPw); save(superuser); } }
public void testChangePassword2() throws RepositoryException, NotExecutableException { String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd"); if (oldPw == null) { // missing property throw new NotExecutableException(); } User user = getTestUser(superuser); try { user.changePassword("pw"); save(superuser); Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), oldPw.toCharArray())); s.logout(); fail("superuser pw has changed. login must fail."); } catch (LoginException e) { // success } finally { user.changePassword(oldPw); save(superuser); } }
public void testChangePasswordWithOldPassword2() throws RepositoryException, NotExecutableException { String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd"); if (oldPw == null) { // missing property throw new NotExecutableException(); } User user = getTestUser(superuser); try { user.changePassword("pw", oldPw); save(superuser); Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), oldPw.toCharArray())); s.logout(); fail("superuser pw has changed. login must fail."); } catch (LoginException e) { // success } finally { user.changePassword(oldPw); save(superuser); } }
public void testChangePasswordWithOldPassword() throws RepositoryException, NotExecutableException { String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd"); if (oldPw == null) { // missing property throw new NotExecutableException(); } User user = getTestUser(superuser); try { try { user.changePassword("pw", "wrongOldPw"); save(superuser); fail("old password didn't match -> changePassword(String,String) should fail."); } catch (RepositoryException e) { // success. } user.changePassword("pw", oldPw); save(superuser); // make sure the user can login with the new pw Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), "pw".toCharArray())); s.logout(); } finally { user.changePassword(oldPw); save(superuser); } }
public void testDisable() throws Exception { boolean remove = false; Session s = getHelper().getReadOnlySession(); Session ss = getHelper().getRepository().login(new SimpleCredentials(userID, pw.toCharArray())); ss.logout(); fail("A disabled user must not be allowed to login any more"); getHelper().getRepository().login(new SimpleCredentials(userID, pw.toCharArray())).logout();