Package org.apache.http.auth

Examples of org.apache.http.auth.NTCredentials


                    if (log.isDebugEnabled()){
                        log.debug(username + " > D="+domain+" R="+realm);
                    }
                    credentialsProvider.setCredentials(
                            new AuthScope(url.getHost(), url.getPort(), realm.length()==0 ? null : realm),
                            new NTCredentials(username, auth.getPass(), localHost, domain));
            } else {
                credentialsProvider.clear();
            }
        } else {
            credentialsProvider.clear();           
View Full Code Here


    }

    public Header authenticate(
            final Credentials credentials,
            final HttpRequest request) throws AuthenticationException {
        NTCredentials ntcredentials = null;
        try {
            ntcredentials = (NTCredentials) credentials;
        } catch (ClassCastException e) {
            throw new InvalidCredentialsException(
             "Credentials cannot be used for NTLM authentication: "
              + credentials.getClass().getName());
        }
        String response = null;
        if (this.state == State.CHALLENGE_RECEIVED || this.state == State.FAILED) {
            response = this.engine.generateType1Msg(
                    ntcredentials.getDomain(),
                    ntcredentials.getWorkstation());
            this.state = State.MSG_TYPE1_GENERATED;
        } else if (this.state == State.MSG_TYPE2_RECEVIED) {
            response = this.engine.generateType3Msg(
                    ntcredentials.getUserName(),
                    ntcredentials.getPassword(),
                    ntcredentials.getDomain(),
                    ntcredentials.getWorkstation(),
                    this.challenge);
            this.state = State.MSG_TYPE3_GENERATED;
        } else {
            throw new AuthenticationException("Unexpected state: " + this.state);
        }
View Full Code Here

          if (proxyAuthDomain == null)
            proxyAuthDomain = "";

          localHttpClient.getCredentialsProvider().setCredentials(
            new AuthScope(proxyHost, proxyPort),
            new NTCredentials(proxyAuthUsername, proxyAuthPassword, currentHost, proxyAuthDomain));
        }

        HttpHost proxy = new HttpHost(proxyHost, proxyPort);

        localHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View Full Code Here

      localHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
      if (strippedUserName != null)
      {
        localHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(serverName,serverPort),
          new NTCredentials(strippedUserName, password, currentHost, ntlmDomain));
      }

      httpClient = localHttpClient;
     
      proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, userName, password,
View Full Code Here

          // Configure proxy authentication
          if (proxyAuthUsername != null && proxyAuthUsername.length() > 0)
          {
            localHttpClient.getCredentialsProvider().setCredentials(
              new AuthScope(proxyHost, proxyPort),
              new NTCredentials(proxyAuthUsername, (proxyAuthPassword==null)?"":proxyAuthPassword, currentHost, (proxyAuthDomain==null)?"":proxyAuthDomain));
          }

          HttpHost proxy = new HttpHost(proxyHost, proxyPort);

          localHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View Full Code Here

      localHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
      // Set up authentication to use
      if (ingestNtlmDomain != null)
      {
        localHttpClient.getCredentialsProvider().setCredentials(AuthScope.ANY,
          new NTCredentials(ingestNtlmUsername,ingestNtlmPassword,currentHost,ingestNtlmDomain));
      }
      httpClient = localHttpClient;
     
      // System.out.println("Connection server object = "+llServer.toString());
View Full Code Here

        if (proxyDomain == null)
          proxyDomain = "";

        localHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(proxyHost, proxyPortInt),
          new NTCredentials(proxyUsername, proxyPassword, currentHost, proxyDomain));
      }

      HttpHost proxy = new HttpHost(proxyHost, proxyPortInt);

      localHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View Full Code Here

        if (proxyDomain == null)
          proxyDomain = "";

        localHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(proxyHost, proxyPortInt),
          new NTCredentials(proxyUsername, proxyPassword, currentHost, proxyDomain));
      }

      HttpHost proxy = new HttpHost(proxyHost, proxyPortInt);

      localHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View Full Code Here

      localHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
      if (strippedUserName != null)
      {
        localHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(serverName,serverPort),
          new NTCredentials(strippedUserName, password, currentHost, ntlmDomain));
      }

      httpClient = localHttpClient;
     
      proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, serverUserName, password,
View Full Code Here

          // Configure proxy authentication
          if (proxyAuthUsername != null && proxyAuthUsername.length() > 0)
          {
            localHttpClient.getCredentialsProvider().setCredentials(
              new AuthScope(proxyHost, proxyPort),
              new NTCredentials(proxyAuthUsername, (proxyAuthPassword==null)?"":proxyAuthPassword, currentHost, (proxyAuthDomain==null)?"":proxyAuthDomain));
          }

          HttpHost proxy = new HttpHost(proxyHost, proxyPort);

          localHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View Full Code Here

TOP

Related Classes of org.apache.http.auth.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.