Package org.apache.http.impl.auth

Examples of org.apache.http.impl.auth.BasicScheme.processChallenge()


        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


            AuthScope targetScope = new AuthScope( targetHost );

            if ( credentialsProvider.getCredentials( targetScope ) != null )
            {
                BasicScheme targetAuth = new BasicScheme();
                targetAuth.processChallenge( new BasicHeader(AUTH.WWW_AUTH, "BASIC preemptive" ) );
                authCache.put( targetHost, targetAuth  );
            }
        }

        if ( proxyInfo != null )
View Full Code Here

                        creds = new UsernamePasswordCredentials( proxyUsername, proxyPassword );
                    }

                    credentialsProvider.setCredentials( proxyScope, creds );
                    BasicScheme proxyAuth = new BasicScheme();
                    proxyAuth.processChallenge( new BasicHeader(AUTH.PROXY_AUTH, "BASIC preemptive" ) );
                    authCache.put( proxyHost, proxyAuth );
                }
            }
        }
View Full Code Here

    @Test
    public void testAuthSucceeded() throws Exception {
        final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        final HttpHost authhost = new HttpHost("somehost", 80);
        final BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        final AuthCache authCache = Mockito.mock(AuthCache.class);

        final HttpClientContext context = HttpClientContext.create();
        context.setAuthCache(authCache);
View Full Code Here

    @Test
    public void testAuthSucceededNoCache() throws Exception {
        final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        final HttpHost authhost = new HttpHost("somehost", 80);
        final BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        final HttpClientContext context = HttpClientContext.create();
        context.setAuthCache(null);

        authStrategy.authSucceeded(authhost, authScheme, context);
View Full Code Here

    @Test
    public void testAuthFailed() throws Exception {
        final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        final HttpHost authhost = new HttpHost("somehost", 80);
        final BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        final AuthCache authCache = Mockito.mock(AuthCache.class);

        final HttpClientContext context = HttpClientContext.create();
        context.setAuthCache(authCache);
View Full Code Here

    @Test
    public void testAuthSucceeded() throws Exception {
        final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        final HttpHost authhost = new HttpHost("somehost", 80);
        final BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        final AuthCache authCache = Mockito.mock(AuthCache.class);

        final HttpContext context = new BasicHttpContext();
        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
View Full Code Here

    @Test
    public void testAuthSucceededNoCache() throws Exception {
        final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        final HttpHost authhost = new HttpHost("somehost", 80);
        final BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        final HttpContext context = new BasicHttpContext();
        context.setAttribute(ClientContext.AUTH_CACHE, null);

        authStrategy.authSucceeded(authhost, authScheme, context);
View Full Code Here

    @Test
    public void testAuthFailed() throws Exception {
        final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        final HttpHost authhost = new HttpHost("somehost", 80);
        final BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        final AuthCache authCache = Mockito.mock(AuthCache.class);

        final HttpContext context = new BasicHttpContext();
        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
View Full Code Here

    @Test
    public void testAuthSucceeded() throws Exception {
        TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
        HttpHost authhost = new HttpHost("somehost", 80);
        BasicScheme authScheme = new BasicScheme();
        authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));

        AuthCache authCache = Mockito.mock(AuthCache.class);

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