Examples of AuthOption


Examples of org.apache.http.auth.AuthOption

                authScheme.getRealm(),
                authScheme.getSchemeName());

        final Credentials credentials = credsProvider.getCredentials(authScope);
        if (credentials != null) {
            options.add(new AuthOption(authScheme, credentials));
        }
        return options;
    }
View Full Code Here

Examples of org.apache.http.auth.AuthOption

                response, authStrategy, this.authState, this.context));
        Assert.assertEquals(AuthProtocolState.CHALLENGED, this.authState.getState());

        final Queue<AuthOption> options = this.authState.getAuthOptions();
        Assert.assertNotNull(options);
        final AuthOption option1 = options.poll();
        Assert.assertNotNull(option1);
        Assert.assertEquals("digest", option1.getAuthScheme().getSchemeName());
        final AuthOption option2 = options.poll();
        Assert.assertNotNull(option2);
        Assert.assertEquals("basic", option2.getAuthScheme().getSchemeName());
        Assert.assertNull(options.poll());
    }
View Full Code Here

Examples of org.apache.http.auth.AuthOption

                response, authStrategy, this.authState, this.context));
        Assert.assertEquals(AuthProtocolState.CHALLENGED, this.authState.getState());

        final Queue<AuthOption> options = this.authState.getAuthOptions();
        Assert.assertNotNull(options);
        final AuthOption option1 = options.poll();
        Assert.assertNotNull(option1);
        Assert.assertEquals("digest", option1.getAuthScheme().getSchemeName());
        Assert.assertNull(options.poll());
    }
View Full Code Here

Examples of org.apache.http.auth.AuthOption

    @Test
    public void testAuthChallengeStateOneOptions() throws Exception {
        final HttpRequest request = new BasicHttpRequest("GET", "/");
        this.authState.setState(AuthProtocolState.CHALLENGED);
        final LinkedList<AuthOption> authOptions = new LinkedList<AuthOption>();
        authOptions.add(new AuthOption(this.authScheme, this.credentials));
        this.authState.update(authOptions);

        Mockito.when(this.authScheme.authenticate(
                Mockito.any(Credentials.class),
                Mockito.any(HttpRequest.class),
View Full Code Here

Examples of org.apache.http.auth.AuthOption

        final ContextAwareAuthScheme authScheme2 = Mockito.mock(ContextAwareAuthScheme.class);
        Mockito.when(authScheme2.authenticate(
                Mockito.any(Credentials.class),
                Mockito.any(HttpRequest.class),
                Mockito.any(HttpContext.class))).thenReturn(new BasicHeader(AUTH.WWW_AUTH_RESP, "stuff"));
        authOptions.add(new AuthOption(authScheme1, this.credentials));
        authOptions.add(new AuthOption(authScheme2, this.credentials));
        this.authState.update(authOptions);

        this.httpAuthenticator.generateAuthResponse(request, authState, context);

        Assert.assertSame(authScheme2, this.authState.getAuthScheme());
View Full Code Here

Examples of org.apache.http.auth.AuthOption

            break;
        case CHALLENGED:
            final Queue<AuthOption> authOptions = authState.getAuthOptions();
            if (authOptions != null) {
                while (!authOptions.isEmpty()) {
                    final AuthOption authOption = authOptions.remove();
                    authScheme = authOption.getAuthScheme();
                    creds = authOption.getCredentials();
                    authState.update(authScheme, creds);
                    if (this.log.isDebugEnabled()) {
                        this.log.debug("Generating response to an authentication challenge using "
                                + authScheme.getSchemeName() + " scheme");
                    }
View Full Code Here

Examples of org.apache.http.auth.AuthOption

                Mockito.<HttpRoute>any(), Mockito.any())).thenReturn(connRequest);
        Mockito.when(connRequest.get(
                Mockito.anyLong(), Mockito.<TimeUnit>any())).thenReturn(managedConn);
        final Map<String, Header> challenges = new HashMap<String, Header>();
        challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));
        final AuthOption authOption = new AuthOption(
                new BasicScheme(), new UsernamePasswordCredentials("user:pass"));
        Mockito.when(targetAuthStrategy.getChallenges(
                Mockito.eq(target),
                Mockito.<HttpResponse>any(),
                Mockito.<HttpClientContext>any())).thenReturn(challenges);
View Full Code Here

Examples of org.apache.http.auth.AuthOption

                        authScheme.getRealm(),
                        authScheme.getSchemeName());

                final Credentials credentials = credsProvider.getCredentials(authScope);
                if (credentials != null) {
                    options.add(new AuthOption(authScheme, credentials));
                }
            } else {
                if (this.log.isDebugEnabled()) {
                    this.log.debug("Challenge for " + id + " authentication scheme not available");
                    // Try again
View Full Code Here

Examples of org.apache.http.auth.AuthOption

        context.setCredentialsProvider(credentialsProvider);

        final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
        Assert.assertNotNull(options);
        Assert.assertEquals(1, options.size());
        final AuthOption option = options.remove();
        Assert.assertTrue(option.getAuthScheme() instanceof DigestScheme);
    }
View Full Code Here

Examples of org.apache.http.auth.AuthOption

        context.setCredentialsProvider(credentialsProvider);

        final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
        Assert.assertNotNull(options);
        Assert.assertEquals(2, options.size());
        final AuthOption option1 = options.remove();
        Assert.assertTrue(option1.getAuthScheme() instanceof DigestScheme);
        final AuthOption option2 = options.remove();
        Assert.assertTrue(option2.getAuthScheme() instanceof BasicScheme);
    }
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.