Examples of AuthCache


Examples of org.apache.http.client.AuthCache

        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
        context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final AuthCache authCache = new BasicAuthCache();
        context.setAttribute(ClientContext.AUTH_CACHE, authCache);

        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, context);
        Assert.assertNull(this.targetState.getAuthScheme());
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
        context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final AuthCache authCache = new BasicAuthCache();
        authCache.put(this.target, this.authscheme1);
        authCache.put(this.proxy, this.authscheme2);

        context.setAttribute(ClientContext.AUTH_CACHE, authCache);

        final HttpRequestInterceptor interceptor = new RequestAuthCache();
        interceptor.process(request, context);
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
        context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final AuthCache authCache = new BasicAuthCache();
        authCache.put(this.target, this.authscheme1);
        authCache.put(this.proxy, this.authscheme2);

        context.setAttribute(ClientContext.AUTH_CACHE, authCache);

        this.targetState.setState(AuthProtocolState.CHALLENGED);
        this.targetState.update(new BasicScheme(), new UsernamePasswordCredentials("user3", "secret3"));
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final HttpResponseInterceptor interceptor = new ResponseAuthCache();
        interceptor.process(response, context);

        final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
        Assert.assertNotNull(authCache);
        Assert.assertSame(this.authscheme1, authCache.get(this.target));
        Assert.assertSame(this.authscheme2, authCache.get(this.proxy));
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);

        final HttpResponseInterceptor interceptor = new ResponseAuthCache();
        interceptor.process(response, context);

        final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
        Assert.assertNull(authCache);
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final HttpResponseInterceptor interceptor = new ResponseAuthCache();
        interceptor.process(response, context);

        final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
        Assert.assertNull(authCache);
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final HttpResponseInterceptor interceptor = new ResponseAuthCache();
        interceptor.process(response, context);

        final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
        Assert.assertNull(authCache);
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final HttpResponseInterceptor interceptor = new ResponseAuthCache();
        interceptor.process(response, context);

        final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
        Assert.assertNotNull(authCache);
        Assert.assertNull(authCache.get(this.target));
        Assert.assertNull(authCache.get(this.proxy));
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
        context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
        context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);

        final AuthCache authCache = new BasicAuthCache();
        authCache.put(this.target, this.authscheme1);
        authCache.put(this.proxy, this.authscheme2);

        context.setAttribute(ClientContext.AUTH_CACHE, authCache);

        final HttpResponseInterceptor interceptor = new ResponseAuthCache();
        interceptor.process(response, context);

        Assert.assertNull(authCache.get(this.target));
        Assert.assertNull(authCache.get(this.proxy));
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

        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);

        authStrategy.authSucceeded(authhost, authScheme, context);
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.