Examples of UsernamePasswordCredentials


Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

    }

    protected DeleteMethod executeDelete(String uri, String userName, String password) throws Exception
    {
        HttpClient httpClient = new HttpClient();
        httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, password));
        httpClient.getParams().setAuthenticationPreemptive(true);

        DeleteMethod deleteMethod = new DeleteMethod(uri);
        httpClient.executeMethod(deleteMethod);
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

        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.UsernamePasswordCredentials

        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.UsernamePasswordCredentials

    Credentials credentials,
    HttpMethod method)
      throws AuthenticationException {
    String auth = null;
    if (credentials instanceof UsernamePasswordCredentials) {
      UsernamePasswordCredentials usercreds =
        (UsernamePasswordCredentials) credentials;
      String id = usercreds.getUserName();
      String pwd = usercreds.getPassword();
      auth = getAuth(id, pwd);
    } else if (credentials instanceof GoogleLoginAuthCredentials) {
      GoogleLoginAuthCredentials gcreds =
        (GoogleLoginAuthCredentials) credentials;
      service = gcreds.getService();
View Full Code Here

Examples of org.apache.http.auth.UsernamePasswordCredentials

    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

Examples of org.apache.http.auth.UsernamePasswordCredentials

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

Examples of org.apache.http.auth.UsernamePasswordCredentials

    }

    }

    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

Examples of org.apache.http.auth.UsernamePasswordCredentials

      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);
        HttpEntity oEnty = oResp.getEntity();
View Full Code Here

Examples of org.apache.http.auth.UsernamePasswordCredentials

    } 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

Examples of org.apache.http.auth.UsernamePasswordCredentials

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