Examples of UsernamePasswordCredentials


Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

  }

  @Test
  public void testSecureLinksPowerUser() throws Exception
  {
    httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("power-user", "asd"));
    Book book = client.getBookXML("foo");
    checkBookLinks1(url, book, "add", "update", "list", "self");
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

  }

  @Test
  public void testSecureLinksUser() throws Exception
  {
    httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("user", "asd"));
    Book book = client.getBookXML("foo");
    checkBookLinks1(url, book, "list", "self");
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

      HttpClient client = new HttpClient();
     
      client.getState().setCredentials(
          //new AuthScope(null, 8080, "Test"),
          new AuthScope(AuthScope.ANY),
          new UsernamePasswordCredentials("bill", "password")
      );
      {
         GetMethod method = new GetMethod("http://localhost:8080/basic-integration-test/security");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

      HttpClient client = new HttpClient();
      client.getParams().setAuthenticationPreemptive(true);

      client.getState().setCredentials(
              //new AuthScope(null, 8080, "Test"),
              new AuthScope(AuthScope.ANY), new UsernamePasswordCredentials("bill", "password"));
      {
         GetMethod method = createGetMethod("/secured");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

      client.getParams().setAuthenticationPreemptive(true);

      client.getState().setCredentials(
              //new AuthScope(null, 8080, "Test"),
              new AuthScope(AuthScope.ANY), new UsernamePasswordCredentials("mo", "password"));
      {
         GetMethod method = createGetMethod("/secured/authorized");
         method.setDoAuthentication(true);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_UNAUTHORIZED, status);
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

    }

    final int domainIdx = user.indexOf(DOMAIN_SEPARATOR);
    if (domainIdx == -1)
    {
      return new UsernamePasswordCredentials(user, password);
    }
    try
    {
      final String domain = user.substring(0, domainIdx);
      final String username = user.substring(domainIdx + 1);
      final String host = InetAddress.getLocalHost().getHostName();
      return new NTCredentials(username, password, host, domain);
    }
    catch (UnknownHostException uhe)
    {
      return new UsernamePasswordCredentials(user, password);
    }
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

            }
        }
        if (this.solraccount.length() > 0) {
            final HttpClient client = new HttpClient();
            final AuthScope scope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, null, null);
            client.getState().setCredentials(scope,new UsernamePasswordCredentials(this.solraccount, this.solrpw));
            final List<String> authPrefs = new ArrayList<String>(2);
            authPrefs.add(AuthPolicy.DIGEST);
            authPrefs.add(AuthPolicy.BASIC);
            // This will exclude the NTLM authentication scheme
            client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

        final PostMethod method = new PostMethod(address);

        if (userNameAndPassword != null && userNameAndPassword.length == 2) {
            client.getState().setCredentials(null,
                                             null,
                                             new UsernamePasswordCredentials(userNameAndPassword[0],
                                                                             userNameAndPassword[1]));
        }

        if (parameters != null) {
            for (Map.Entry<String, String> e : parameters.entrySet()) {
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

        final MultipartPostMethod method = new MultipartPostMethod(address);

        if (userNameAndPassword != null && userNameAndPassword.length == 2) {
            client.getState().setCredentials(null,
                                             null,
                                             new UsernamePasswordCredentials(userNameAndPassword[0],
                                                                             userNameAndPassword[1]));
        }

        for (Map.Entry<String, byte[]> e : uploads.entrySet()) {
            method.addPart(new FilePart("filepath",
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

        throws Exception
    {
        TestSuite suite = new TestSuite();

        HttpClient adminClient = new HttpClient();
        Credentials defaultcreds = new UsernamePasswordCredentials("Admin", "admin");
        adminClient.getState().setCredentials(AuthScope.ANY, defaultcreds);

        addXarFiles(validationTest, validator, suite, adminClient);
        addURLsForAdmin(validationTest, validator, suite, adminClient);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.