Examples of BasicAuthCache


Examples of org.apache.http.impl.client.BasicAuthCache

          httpclient.getCredentialsProvider().setCredentials(
                new AuthScope(AuthScope.ANY),
                this.credentials);
       
          // Create AuthCache instance
          AuthCache authCache = new BasicAuthCache();
          // Generate BASIC scheme object and add it to the local auth cache
          BasicScheme basicAuth = new BasicScheme();
          authCache.put(targetHost, basicAuth);

          // Add AuthCache to the execution context
          BasicHttpContext localcontext = new BasicHttpContext();
          localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
        } else {
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

      ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials(
              new AuthScope(hostName, port),
              this.credentials);
     
      // Create AuthCache instance
      AuthCache authCache = new BasicAuthCache();
      // Generate BASIC scheme object and add it to the local auth cache
      BasicScheme basicAuth = new BasicScheme();
   
      authCache.put(targetHost, basicAuth);

      // Add AuthCache to the execution context
      BasicHttpContext localcontext = new BasicHttpContext();
      localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
    }
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

    httpClient.getCredentialsProvider().setCredentials(
        new AuthScope( host, port ),
        new UsernamePasswordCredentials( serverAdminUser, serverAdminPassword )
        );

    AuthCache authCache = new BasicAuthCache();
    authCache.put(
        new HttpHost( host, port, "http" ),
        new BasicScheme()
        );

    BasicHttpContext localContext = new BasicHttpContext();
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

    try {
      HttpHost targetHost = new HttpHost(builder.getHost(), builder.getPort(), builder.getScheme());

      HttpClientContext localcontext = HttpClientContext.create();
      if (isAuthConfigured) {
        AuthCache authCache = new BasicAuthCache();
        BasicScheme basicAuth = new BasicScheme();
        authCache.put(targetHost, basicAuth);
        localcontext.setAuthCache(authCache);
      }

      response = httpclient.execute(targetHost, method, localcontext);
      int statusCode = response.getStatusLine().getStatusCode();
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

      BasicHttpContext localcontext = new BasicHttpContext();
      if (isAuthConfigured) {
        // Preemptive authentication enabled - see
        // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d5e1032
        HttpHost targetHost = new HttpHost(builder.getHost(), builder.getPort(), builder.getScheme());
        AuthCache authCache = new BasicAuthCache();
        BasicScheme basicAuth = new BasicScheme();
        authCache.put(targetHost, basicAuth);
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
      }

      HttpResponse response = httpclient.execute(method, localcontext);
      int statusCode = response.getStatusLine().getStatusCode();
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

        // Add AuthCache to the execution context
        BasicHttpContext localcontext = new BasicHttpContext();

        // Generate BASIC scheme object and add it to the local auth cache
        AuthCache authCache = new BasicAuthCache();
        authCache.put(targetHost, new BasicScheme());
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);

        HttpResponse response = null;

        maxit = 10;
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

        // Add AuthCache to the execution context
        BasicHttpContext localcontext = new BasicHttpContext();

        // Generate BASIC scheme object and add it to the local auth cache
        AuthCache authCache = new BasicAuthCache();
        authCache.put(targetHost, new BasicScheme());
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);

        HttpResponse response = null;

        maxit = 10;
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

            String host = url.getHost();
            int port = url.getPort() > -1 ? url.getPort() : AuthScope.ANY_PORT;

            httpClient.getCredentialsProvider().setCredentials( new AuthScope( host, port ), creds );

            AuthCache authCache = new BasicAuthCache();
            BasicScheme basicAuth = new BasicScheme();
            HttpHost targetHost = new HttpHost( url.getHost(), url.getPort(), url.getProtocol() );
            authCache.put( targetHost, basicAuth );

            localContext = new BasicHttpContext();
            localContext.setAttribute( ClientContext.AUTH_CACHE, authCache );
        }
    }
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

    {
        repository.setUrl( getURL( repository ) );

        localContext = HttpClientContext.create();
        credentialsProvider = new BasicCredentialsProvider();
        authCache = new BasicAuthCache();
        localContext.setCredentialsProvider( credentialsProvider );
        localContext.setAuthCache( authCache );

        if ( authenticationInfo != null )
        {
View Full Code Here

Examples of org.apache.http.impl.client.BasicAuthCache

            String host = getRepository().getHost();
            int port = getRepository().getPort() > -1 ? getRepository().getPort() : AuthScope.ANY_PORT;

            client.getCredentialsProvider().setCredentials( new AuthScope( host, port ), creds );

            AuthCache authCache = new BasicAuthCache();
            BasicScheme basicAuth = new BasicScheme();
            HttpHost targetHost = new HttpHost( repository.getHost(), repository.getPort(), repository.getProtocol() );
            authCache.put( targetHost, basicAuth );

            localContext = new BasicHttpContext();
            localContext.setAttribute( ClientContext.AUTH_CACHE, authCache );
        }
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.