Examples of BasicScheme


Examples of org.apache.http.impl.auth.BasicScheme

            exchange.getIn().getHeaders().remove("host");
        }
        HttpRequestBase httpRequest = createMethod(exchange);
        if (getEndpoint().isAuthenticationPreemptive()) {
            Credentials creds = ((DefaultHttpClient) httpClient).getCredentialsProvider().getCredentials(AuthScope.ANY);
            httpRequest.addHeader(new BasicScheme().authenticate(creds, httpRequest));
        }
        Message in = exchange.getIn();
        String httpProtocolVersion = in.getHeader(Exchange.HTTP_PROTOCOL_VERSION, String.class);
        if (httpProtocolVersion != null) {
            // set the HTTP protocol version
View Full Code Here

Examples of org.apache.http.impl.auth.BasicScheme

      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);
View Full Code Here

Examples of org.apache.http.impl.auth.BasicScheme

            ((DefaultHttpClient)client).getCredentialsProvider().setCredentials(authScope, creds);

            localContext = new BasicHttpContext();

            // Generate BASIC scheme object and stick it to the local execution context
            BasicScheme basicAuth = new BasicScheme();
            localContext.setAttribute("preemptive-auth", basicAuth);

            // Add as the first request interceptor
            ((DefaultHttpClient)client).addRequestInterceptor(new PreemptiveAuth(), 0);
            executor.setHttpContext(localContext);
View Full Code Here

Examples of org.apache.http.impl.auth.BasicScheme

      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);
View Full Code Here

Examples of org.apache.http.impl.auth.BasicScheme

        // 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.auth.BasicScheme

        // 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.auth.BasicScheme

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

        BasicHttpContext localcontext = new BasicHttpContext();

        // Generate BASIC scheme object and stick it to the local
        // execution context
        BasicScheme basicAuth = new BasicScheme();
        localcontext.setAttribute("preemptive-auth", basicAuth);
       
        // Add as the first request interceptor
        httpclient.addRequestInterceptor(new PreemptiveAuth(), 0);
       
View Full Code Here

Examples of org.apache.http.impl.auth.BasicScheme

            this.currentRequest = this.mainRequest.getRequest();

            String userinfo = this.currentRequest.getURI().getUserInfo();
            if (userinfo != null) {
                this.targetAuthState.update(
                        new BasicScheme(), new UsernamePasswordCredentials(userinfo));
            }

            // Re-write request URI if needed
            rewriteRequestURI(this.currentRequest, route);
        }
View Full Code Here

Examples of org.apache.http.impl.auth.BasicScheme

        HttpHost targetHost = new HttpHost( repo.getHost(), repo.getPort(), repo.getProtocol() );
        AuthScope targetScope = new AuthScope( targetHost );

        if ( credentialsProvider.getCredentials( targetScope ) != null )
        {
            BasicScheme targetAuth = new BasicScheme();
            try {
                targetAuth.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "BASIC preemptive"));
                authCache.put( targetHost, targetAuth  );
            }
            catch ( MalformedChallengeException ignore )
            {
            }
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.