Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.Credentials


    postParams.add(new NameValuePair("privilege@jcr:versionManagement", "denied"));
    postParams.add(new NameValuePair("privilege@jcr:read", "denied"));
    postParams.add(new NameValuePair("privilege@jcr:modifyAccessControl", "denied"));
    postParams.add(new NameValuePair("privilege@rep:write", "denied"));
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    /*String json = */H.getAuthenticatedPostContent(creds, postUrl, HttpTest.CONTENT_TYPE_JSON, postParams, HttpServletResponse.SC_OK);

   
        //2. now grant the jcr:write subset from the rep:write aggregate privilege
    postParams = new ArrayList<NameValuePair>();
View Full Code Here


    postParams.add(new NameValuePair("privilege@jcr:versionManagement", "denied"));
    postParams.add(new NameValuePair("privilege@jcr:read", "denied"));
    postParams.add(new NameValuePair("privilege@jcr:modifyAccessControl", "denied"));
    postParams.add(new NameValuePair("privilege@rep:write", "denied"));
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    /*String json = */H.getAuthenticatedPostContent(creds, postUrl, HttpTest.CONTENT_TYPE_JSON, postParams, HttpServletResponse.SC_OK);

        //2. now grant the all the privileges contained in the rep:write privilege
    postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("principalId", testUserId));
View Full Code Here

        try {
            assertContent();
        } finally {
            // re-enable credentials -> admin session
            httpClient.getParams().setAuthenticationPreemptive(true);
            Credentials defaultcreds = new UsernamePasswordCredentials("admin", "admin");
            httpClient.getState().setCredentials(scope, defaultcreds);
        }
    }
View Full Code Here

    postParams.add(new NameValuePair("oldPwd", "wrongTestPwd"));
    postParams.add(new NameValuePair("newPwd", "testNewPwd"));
    postParams.add(new NameValuePair("newPwdConfirm", "testNewPwd"));
   
    //Credentials creds = new UsernamePasswordCredentials(testUserId, "testPwd");
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    H.assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);
  }
View Full Code Here

    postParams.add(new NameValuePair("oldPwd", "testPwd"));
    postParams.add(new NameValuePair("newPwd", "testNewPwd"));
    postParams.add(new NameValuePair("newPwdConfirm", "wrongTestNewPwd"));
   
    //Credentials creds = new UsernamePasswordCredentials(testUserId, "testPwd");
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    H.assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);
  }
View Full Code Here

        String postUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".update.json";

    List<NameValuePair> postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("displayName", "My Updated Test User"));
    postParams.add(new NameValuePair("url", "http://www.apache.org/updated"));
    Credentials creds = new UsernamePasswordCredentials(testUserId, "testPwd");
    String json = H.getAuthenticatedPostContent(creds, postUrl, HttpTest.CONTENT_TYPE_JSON, postParams, HttpServletResponse.SC_OK);

    //make sure the json response can be parsed as a JSON object
    JSONObject jsonObj = new JSONObject(json);
    assertNotNull(jsonObj);
View Full Code Here

    List<NameValuePair> postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("newPwd", "testNewPwd"));
    postParams.add(new NameValuePair("newPwdConfirm", "testNewPwd"));
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    H.assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);
  }
View Full Code Here

    List<NameValuePair> postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("newPwd", "testNewPwd"));
    postParams.add(new NameValuePair("newPwdConfirm", "testNewPwd"));
   
    Credentials creds = new UsernamePasswordCredentials(testUserId, "testPwd");
    H.assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);
  }
View Full Code Here

 
  @After
  public void cleanup() throws Exception {
    H.tearDown();

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");

    if (testUserId != null) {
      //remove the test user if it exists.
      String postUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".delete.html";
      List<NameValuePair> postParams = new ArrayList<NameValuePair>();
View Full Code Here

        //1. create an initial set of privileges
    List<NameValuePair> postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("principalId", testUserId));
    postParams.add(new NameValuePair("privilege@jcr:write", "granted"));
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    H.assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);
   
    postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("principalId", testUserId2));
    postParams.add(new NameValuePair("privilege@jcr:write", "granted"));
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.Credentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.