Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials


    addOrUpdateAce(testFolderUrl, testGroupId, true, "after " + testUserId);

    //fetch the JSON for the acl to verify the settings.
    String getUrl = testFolderUrl + ".acl.json";

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    String json = H.getAuthenticatedContent(creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);

                JSONObject jsonObject = new JSONObject(json);
                assertEquals(2, jsonObject.length());
View Full Code Here


    addOrUpdateAce(testFolderUrl, testGroupId, true, "0");

    //fetch the JSON for the acl to verify the settings.
    String getUrl = testFolderUrl + ".acl.json";

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    String json = H.getAuthenticatedContent(creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);

   
                JSONObject jsonObject = new JSONObject(json);
View Full Code Here

   
   
    //fetch the JSON for the acl to verify the settings.
    String getUrl = testFolderUrl + ".acl.json";

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    String json = H.getAuthenticatedContent(creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
   
                JSONObject jsonObject = new JSONObject(json);
                assertEquals(2, jsonObject.length());
View Full Code Here

    addOrUpdateAce(testFolderUrl, testUserId, true, null);

    //fetch the JSON for the acl to verify the settings.
    String getUrl = testFolderUrl + ".acl.json";

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    String json = H.getAuthenticatedContent(creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
   
                JSONObject jsonObject = new JSONObject(json);
                assertEquals(1, jsonObject.length());
View Full Code Here

    postParams.add(new NameValuePair("privilege@jcr:write", "denied"));
    if (order != null) {
      postParams.add(new NameValuePair("order", order));
    }
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    H.assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);
  }
View Full Code Here

    postParams.add(new NameValuePair("principalId", testUserId));
    postParams.add(new NameValuePair("privilege@jcr:read", "granted"));
    postParams.add(new NameValuePair("privilege@jcr:write", "denied"));
    postParams.add(new NameValuePair("privilege@jcr:modifyAccessControl", "bogus")); //invalid value should be ignored.
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    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 jsonObject = new JSONObject(json);
    assertNotNull(jsonObject);
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 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

    private void addHttpAuth(Settings settings, Object[] authSettings) {
        if (StringUtils.hasText(settings.getNetworkHttpAuthUser())) {
            HttpState state = (authSettings[1] != null ? (HttpState) authSettings[1] : new HttpState());
            authSettings[1] = state;
            state.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(settings.getNetworkHttpAuthUser(), settings.getNetworkHttpAuthPass()));
            if (log.isDebugEnabled()) {
                log.info("Using detected HTTP Auth credentials...");
            }
        }
    }
View Full Code Here

TOP

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

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.