Package org.apache.http.auth

Examples of org.apache.http.auth.NTCredentials


    protected Credentials createCredentials(URI target) {
        Pair<Tuple<String>, char[]> credentials = this.getCredentials(target);
        if (credentials == null)
            return super.createCredentials(target);

        return new NTCredentials(credentials.getLeft().get(0), new String(credentials.getRight()), credentials.getLeft().get(1),
                credentials.getLeft().get(2));
    }
View Full Code Here


                String proxyUser = getProxyUser();
               
                if (proxyUser.length() > 0) {                  
                    ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
                            new AuthScope(proxyHost, proxyPort),
                            new NTCredentials(proxyUser, getProxyPass(), localHost, PROXY_DOMAIN));
                }
            } else if (useStaticProxy) {
                HttpHost proxy = new HttpHost(PROXY_HOST, PROXY_PORT);
                clientParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
                if (PROXY_USER.length() > 0) {
                    ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
                            new AuthScope(PROXY_HOST, PROXY_PORT),
                            new NTCredentials(PROXY_USER, PROXY_PASS, localHost, PROXY_DOMAIN));
                }
            }

            // Bug 52126 - we do our own cookie handling
            clientParams.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES);
View Full Code Here

                ((AbstractHttpClient) client).getAuthSchemes().register(AuthPolicy.SPNEGO, new SPNegoSchemeFactory(true));
                credentialsProvider.setCredentials(new AuthScope(null, -1, null), USE_JAAS_CREDENTIALS);
            } else {
                credentialsProvider.setCredentials(
                        new AuthScope(url.getHost(), url.getPort(), realm.length()==0 ? null : realm),
                        new NTCredentials(username, auth.getPass(), localHost, domain));
            }
        }
    }
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

                String proxyUser = getProxyUser();
               
                if (proxyUser.length() > 0) {                  
                    ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
                            new AuthScope(proxyHost, proxyPort),
                            new NTCredentials(proxyUser, getProxyPass(), localHost, PROXY_DOMAIN));
                }
            } else if (useStaticProxy) {
                HttpHost proxy = new HttpHost(PROXY_HOST, PROXY_PORT);
                clientParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
                if (PROXY_USER.length() > 0) {
                    ((AbstractHttpClient) httpClient).getCredentialsProvider().setCredentials(
                            new AuthScope(PROXY_HOST, PROXY_PORT),
                            new NTCredentials(PROXY_USER, PROXY_PASS, localHost, PROXY_DOMAIN));
                }
            }

            // Bug 52126 - we do our own cookie handling
            clientParams.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES);
View Full Code Here

    localDmwsHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
    if (domainUser != null)
    {
      localDmwsHttpClient.getCredentialsProvider().setCredentials(
        new AuthScope(meridioDmwsUrl.getHost(),meridioDmwsUrl.getPort()),
        new NTCredentials(domainUser, password, currentHost, domain));
    }
    // Initialize proxy
    if (dmwsProxyHost != null && dmwsProxyHost.length() > 0)
    {
      int port = (dmwsProxyPort == null || dmwsProxyPort.length() == 0)?8080:Integer.parseInt(dmwsProxyPort);
      // Configure proxy authentication
      if (domainUser != null && domainUser.length() > 0)
      {
        localDmwsHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(dmwsProxyHost, port),
          new NTCredentials(domainUser, password, currentHost, domain));
      }

      HttpHost proxy = new HttpHost(dmwsProxyHost, port);
      localDmwsHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
    }
    dmwsHttpClient = localDmwsHttpClient;
   
    // rmws
    BasicHttpParams rmwsParams = new BasicHttpParams();
    rmwsParams.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
    rmwsParams.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,false);
    rmwsParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,900000);
    rmwsParams.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS,true);
    DefaultHttpClient localRmwsHttpClient = new DefaultHttpClient(connectionManager,rmwsParams);
    // No retries
    localRmwsHttpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler()
      {
  public boolean retryRequest(
    IOException exception,
    int executionCount,
          HttpContext context)
  {
    return false;
  }
    
      });

    localRmwsHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
    if (domainUser != null)
    {
      localRmwsHttpClient.getCredentialsProvider().setCredentials(
        new AuthScope(meridioRmwsUrl.getHost(),meridioRmwsUrl.getPort()),
        new NTCredentials(domainUser, password, currentHost, domain));
    }
    // Initialize proxy
    if (rmwsProxyHost != null && rmwsProxyHost.length() > 0)
    {
      int port = (rmwsProxyPort == null || rmwsProxyPort.length() == 0)?8080:Integer.parseInt(rmwsProxyPort);
      // Configure proxy authentication
      if (domainUser != null && domainUser.length() > 0)
      {
        localRmwsHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(rmwsProxyHost, port),
          new NTCredentials(domainUser, password, currentHost, domain));
      }

      HttpHost proxy = new HttpHost(rmwsProxyHost, port);
      localRmwsHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
    }
    rmwsHttpClient = localRmwsHttpClient;

    // mcws
    if (meridioManifoldCFWSUrl != null)
    {
      BasicHttpParams mcwsParams = new BasicHttpParams();
      mcwsParams.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
      mcwsParams.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,false);
      mcwsParams.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,900000);
      mcwsParams.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS,true);
      DefaultHttpClient localMcwsHttpClient = new DefaultHttpClient(connectionManager,mcwsParams);
      // No retries
      localMcwsHttpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler()
        {
          public boolean retryRequest(
            IOException exception,
            int executionCount,
            HttpContext context)
          {
            return false;
          }
      
        });

      localMcwsHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
      if (domainUser != null)
      {
        localMcwsHttpClient.getCredentialsProvider().setCredentials(
          new AuthScope(meridioManifoldCFWSUrl.getHost(),meridioManifoldCFWSUrl.getPort()),
          new NTCredentials(domainUser, password, currentHost, domain));
      }
      // Initialize proxy
      if (mcwsProxyHost != null && mcwsProxyHost.length() > 0)
      {
        int port = (mcwsProxyPort == null || mcwsProxyPort.length() == 0)?8080:Integer.parseInt(mcwsProxyPort);
        // Configure proxy authentication
        if (domainUser != null && domainUser.length() > 0)
        {
          localMcwsHttpClient.getCredentialsProvider().setCredentials(
            new AuthScope(mcwsProxyHost, port),
            new NTCredentials(domainUser, password, currentHost, domain));
        }

        HttpHost proxy = new HttpHost(mcwsProxyHost, port);
        localMcwsHttpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
      }
View Full Code Here

      localHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
      // Set up authentication to use
      if (ntlmDomain != null)
      {
        localHttpClient.getCredentialsProvider().setCredentials(AuthScope.ANY,
          new NTCredentials(ntlmUsername,ntlmPassword,currentHost,ntlmDomain));
      }
      httpClient = localHttpClient;
     
      // System.out.println("Connection server object = "+llServer.toString());
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

        this.localServer.register("*", new NtlmResponseHandler());
        this.localServer.start();

        BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(AuthScope.ANY,
                new NTCredentials("test", "test", null, null));

        this.httpclient.setCredentialsProvider(credsProvider);

        HttpContext context = new BasicHttpContext();

View Full Code Here

                "AGUAcgB2AGUAcgA="));
        this.localServer.start();

        BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(AuthScope.ANY,
                new NTCredentials("test", "test", null, null));

        this.httpclient.setCredentialsProvider(credsProvider);

        HttpContext context = new BasicHttpContext();
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.