@Bug(9792)
  public void testLoginWithoutReadAccess() throws Exception {
    openid = createServer();

    jenkins.setSecurityRealm(realm);
    User u = realm.createAccount("aliceW", "aliceW");
    associateUserWithOpenId(u);

    // configure Jenkins to allow no access at all without login
    GlobalMatrixAuthorizationStrategy s = new GlobalMatrixAuthorizationStrategy();
    s.add(Jenkins.ADMINISTER, "authenticated");
    jenkins.setAuthorizationStrategy(s);

    // try to login
    login(new WebClient());
  }
  private void prepareSecurity() {
    // This allows any users authenticate name == password
    j.jenkins.setSecurityRealm(j.createDummySecurityRealm());

    GlobalMatrixAuthorizationStrategy authorization = new GlobalMatrixAuthorizationStrategy();
    authorization.add(Jenkins.ADMINISTER, "admin");
    authorization.add(Jenkins.READ, "test1");
    authorization.add(Item.READ, "test1");
    authorization.add(Item.CONFIGURE, "test1");
    authorization.add(Jenkins.READ, "test2");
    authorization.add(Item.READ, "test2");
    authorization.add(Item.CONFIGURE, "test2");

    // This is required for CLI, JENKINS-12543.
    authorization.add(Jenkins.READ, "anonymous");
    authorization.add(Item.READ, "anonymous");

    j.jenkins.setAuthorizationStrategy(authorization);
  }