Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.NTCredentials


      if (proxyUsername.length() > 0) {

        AuthScope proxyAuthScope = getAuthScope(
            this.proxyHost, this.proxyPort, this.proxyRealm);

        NTCredentials proxyCredentials = new NTCredentials(
            this.proxyUsername, this.proxyPassword,
            this.agentHost, this.proxyRealm);

        client.getState().setProxyCredentials(
            proxyAuthScope, proxyCredentials);
View Full Code Here


            String realm = scopeElement.getAttribute("realm");
            String scheme = scopeElement.getAttribute("scheme");

            // Set credentials for the determined scope
            AuthScope authScope = getAuthScope(host, port, realm, scheme);
            NTCredentials credentials = new NTCredentials(
                username, password, agentHost, realm);

            client.getState().setCredentials(authScope, credentials);

            if (LOG.isTraceEnabled()) {
View Full Code Here

              + "; not found for url: " + url);

      AuthScope serverAuthScope = getAuthScope(
          url.getHost(), port, defaultRealm, defaultScheme);

      NTCredentials serverCredentials = new NTCredentials(
          defaultUsername, defaultPassword,
          agentHost, defaultRealm);

      client.getState().setCredentials(
          serverAuthScope, serverCredentials);
View Full Code Here

        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

                    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,
                                    auth.getPass(),
                                    localHost,
                                    domain
                            ));
View Full Code Here

    if (!param.getProxyChainUserName().equals("")) {

      // NTCredentials credentials = new NTCredentials(
      // param.getProxyChainUserName(), param.getProxyChainPassword(),
      // param.getProxyChainName(), param.getProxyChainName());
      NTCredentials credentials = new NTCredentials(
          param.getProxyChainUserName(),
          param.getProxyChainPassword(), "",
          param.getProxyChainRealm().equals("")
            ? "" : param.getProxyChainRealm());
View Full Code Here

  private void addAuth(HttpClient client) {
    List<HostAuthentication> list = param.getListAuth();
    for (int i = 0; i < list.size(); i++) {
      HostAuthentication auth = (HostAuthentication) list.get(i);
      AuthScope authScope = null;
      NTCredentials credentials = null;
      try {
        authScope = new AuthScope(auth.getHostName(), auth.getPort(),
          (auth.getRealm() == null || auth.getRealm().equals("")) ? AuthScope.ANY_REALM : auth.getRealm());
        credentials = new NTCredentials(auth.getUserName(), auth.getPassword(),
          InetAddress.getLocalHost().getCanonicalHostName(), auth.getHostName());
        client.getState().setCredentials(authScope, credentials);
      } catch (UnknownHostException e1) {
        e1.printStackTrace();
      }
View Full Code Here

        } else {
            user = username;
            domain = System.getProperty("http.auth.ntlm.domain", "");
        }
       
        return new NTCredentials(user, password, HostUtil.getLocalHostName(), domain);
    }
View Full Code Here

      } else {
        Authorization auth = authManager.getAuthForURL(u);
        if (auth != null) {
          // TODO - set up realm, thishost and domain
          httpState.setCredentials(null, // "realm"
              auth.getURL(), new NTCredentials(// Includes
                                // other types
                                // of
                                // Credentials
                  auth.getUser(), auth.getPass(), null, // "thishost",
                  null // "targetdomain"
View Full Code Here

                    String domain = readConsole();  
                    System.out.print("Enter username: ");
                    String user = readConsole();  
                    System.out.print("Enter password: ");
                    String password = readConsole();
                    return new NTCredentials(user, password, host, domain);   
                } else
                if (authscheme instanceof RFC2617Scheme) {
                    System.out.println(host + ":" + port + " requires authentication with the realm '"
                        + authscheme.getRealm() + "'");
                    System.out.print("Enter username: ");
View Full Code Here

TOP

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

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.