Examples of AuthScope


Examples of org.apache.commons.httpclient.auth.AuthScope

    params.setSoTimeout(10000);
    HttpClient c = new HttpClient(connectionManager);

    // use basic authentication if available
    if (user != null && user.length() > 0) {
      AuthScope authScope = new AuthScope(null, -1, null);
      Credentials credentials = new UsernamePasswordCredentials(user, password);
      c.getState().setCredentials(authScope, credentials);
    }
    return c;
  }
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

   {
      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);
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

      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.auth.AuthScope

      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.auth.AuthScope

                this.solraccount = userinfo.substring(0, p); this.solrpw = userinfo.substring(p + 1);
            }
        }
        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
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

    protected void setUp() throws Exception
    {
        super.setUp();
        client = new HttpClient();
        client.getState().setCredentials(
            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME),
            new UsernamePasswordCredentials("Admin", "admin"));
        client.getHttpConnectionManager().getParams().setConnectionTimeout(10000);     
        client.getParams().setAuthenticationPreemptive(true);
    }
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        // Set up any required Proxy credentials
        if (useDynamicProxy){
            String user = getProxyUser();
            if (user.length() > 0){
                httpClient.getState().setProxyCredentials(
                        new AuthScope(proxyHost,proxyPort,null,AuthScope.ANY_SCHEME),
                        new NTCredentials(user,getProxyPass(),localHost,PROXY_DOMAIN)
                    );
            } else {
                httpClient.getState().clearProxyCredentials();
            }
        } else {
            if (useStaticProxy) {
                if (PROXY_USER.length() > 0){
                    httpClient.getState().setProxyCredentials(
                        new AuthScope(PROXY_HOST,PROXY_PORT,null,AuthScope.ANY_SCHEME),
                        new NTCredentials(PROXY_USER,PROXY_PASS,localHost,PROXY_DOMAIN)
                    );
                }
            } else {
                httpClient.getState().clearProxyCredentials();
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
                    state.setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                    realm.length()==0 ? null : realm //"" is not the same as no realm
                                    ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                                    username,
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        }
        this.username = System.getProperty(("webdav.test.username"), "");
        this.password = System.getProperty(("webdav.test.password"), "");
        this.client = new HttpClient();
        this.client.getState().setCredentials(
                new AuthScope(this.uri.getHost(), this.uri.getPort()),
                new UsernamePasswordCredentials(this.username, this.password));
        super.setUp();
    }
View Full Code Here

Examples of org.apache.commons.httpclient.auth.AuthScope

        }
        this.username = System.getProperty(("webdav.test.username"), "");
        this.password = System.getProperty(("webdav.test.password"), "");
        this.client = new HttpClient();
        this.client.getState().setCredentials(
                new AuthScope(this.uri.getHost(), this.uri.getPort()),
                new UsernamePasswordCredentials(this.username, this.password));
        super.setUp();
    }
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.