Package org.apache.http.auth

Examples of org.apache.http.auth.AuthScope


    HttpHost proxy = new HttpHost(proxyHost, proxyPort);
    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
  }

  public static void setProxy(String proxyHost, int proxyPort, String username, String password) {
    httpclient.getCredentialsProvider().setCredentials(new AuthScope(proxyHost, proxyPort),
        new UsernamePasswordCredentials(username, password));
    setProxy(proxyHost, proxyPort);
  }
View Full Code Here


                    proxyProperties.getProxyPort());

          client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

            //now set headers for auth
            AuthScope authScope = new AuthScope(AuthScope.ANY_HOST,
                    AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME);
            Credentials credentials = proxyProperties.getCredentials();
            client.getCredentialsProvider().setCredentials(authScope, credentials);
        }
View Full Code Here

    }
   
    public static void setProxyCreds(AbstractHttpClient httpClient) {
      if (!use) return;
      httpClient.getCredentialsProvider().setCredentials(
          new AuthScope(host, port),
          new UsernamePasswordCredentials(user, password));
    }
View Full Code Here

    }

    public static void setAuth(final String host, final int port, final String user, final String pw) {
        final UsernamePasswordCredentials creds = new UsernamePasswordCredentials(user, pw);
        final AuthScope scope = new AuthScope(host, port);
        credsProvider.setCredentials(scope, creds);
        httpClient.getParams().setParameter(ClientContext.CREDS_PROVIDER, credsProvider);
    }
View Full Code Here

      } else {
      if (null==oHttpCli) {
        oHttpCli = new DefaultHttpClient();
      } // fi (oHttpCli)

    oHttpCli.getCredentialsProvider().setCredentials(new AuthScope(oUrl.getHost(), AuthScope.ANY_PORT, realm()),
                             new UsernamePasswordCredentials(user(), password()));       
      HttpGet oGet = null;
      try {
        oGet = new HttpGet(sFilePath);     
        HttpResponse oResp = oHttpCli.execute(oGet);
View Full Code Here

        oStrm.close();
    } else {
      if (null==oHttpCli) {       
        oHttpCli = new DefaultHttpClient();
      } // fi (oHttpCli)
    oHttpCli.getCredentialsProvider().setCredentials(new AuthScope(oUrl.getHost(), AuthScope.ANY_PORT, realm()),
                             new UsernamePasswordCredentials(user(), password()));       
      HttpGet oGet = null;
      try {

        oGet = new HttpGet(sFilePath);     
View Full Code Here

      final HttpHost proxy = new HttpHost(proxyHostname, proxyPort);
      httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

      if (userPreferences.isProxyAuthenticationEnabled()) {
        final AuthScope authScope = new AuthScope(proxyHostname, proxyPort);
        final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(
            userPreferences.getProxyUsername(), userPreferences.getProxyPassword());
        httpClient.getCredentialsProvider().setCredentials(authScope, credentials);
      }
    }
View Full Code Here

   */ 
  public XMLRPCClient(URI uri, String username, String password) {
        this(uri);
       
        ((DefaultHttpClient) client).getCredentialsProvider().setCredentials(
        new AuthScope(uri.getHost(), uri.getPort(),AuthScope.ANY_REALM),
        new UsernamePasswordCredentials(username, password));
    }
View Full Code Here

   */ 
  public XMLRPCClient(URI uri, String username, String password, HttpClient client) {
        this(uri, client);
       
        ((DefaultHttpClient) this.client).getCredentialsProvider().setCredentials(
        new AuthScope(uri.getHost(), uri.getPort(),AuthScope.ANY_REALM),
        new UsernamePasswordCredentials(username, password));
    }
View Full Code Here

    if(doPreemptiveAuth = true) {
      this.httpPreAuth = doPreemptiveAuth;
      this.username = username;
      this.password = password;
    } else {
      ((DefaultHttpClient) client).getCredentialsProvider().setCredentials(new AuthScope(postMethod.getURI().getHost(), postMethod.getURI().getPort(), AuthScope.ANY_REALM), new UsernamePasswordCredentials(username, password));
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.http.auth.AuthScope

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.