Examples of ConsumerManager


Examples of org.openid4java.consumer.ConsumerManager

    @Create
    public void init()
        throws ConsumerException
    {
        manager = new ConsumerManager();
        discovered = null;
        id = null;
        validatedId = null;
    }
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

     */
    private ConsumerManager getConsumerManager() {
        if(this.consumerManager != null) {
            return this.consumerManager;
        }
        return new ConsumerManager();
    }
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

    List<OpenIDAttribute> attributes = Arrays.asList(new OpenIDAttribute("a","b"), new OpenIDAttribute("b","b", Arrays.asList("c")));

    @SuppressWarnings("deprecation")
    @Test
    public void beginConsumptionCreatesExpectedSessionData() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        AuthRequest authReq = mock(AuthRequest.class);
        DiscoveryInformation di = mock(DiscoveryInformation.class);

        when(mgr.authenticate(any(DiscoveryInformation.class), anyString(), anyString())).thenReturn(authReq);
        when(mgr.associate(anyList())).thenReturn(di);

        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, attributes);

        MockHttpServletRequest request = new MockHttpServletRequest();
        consumer.beginConsumption(request, "", "", "");
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

        consumer.beginConsumption(request, "", "", "");
    }

    @Test(expected = OpenIDConsumerException.class)
    public void discoveryExceptionRaisesOpenIDException() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory());
        when(mgr.discover(anyString())).thenThrow(new DiscoveryException("msg"));
        consumer.beginConsumption(new MockHttpServletRequest(), "", "", "");
    }
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

        consumer.beginConsumption(new MockHttpServletRequest(), "", "", "");
    }

    @Test
    public void messageOrConsumerAuthenticationExceptionRaisesOpenIDException() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory());

        when(mgr.authenticate(any(DiscoveryInformation.class), anyString(), anyString()))
                .thenThrow(new MessageException("msg"), new ConsumerException("msg"));

        try {
            consumer.beginConsumption(new MockHttpServletRequest(), "", "", "");
            fail();
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

        }
    }

    @Test
    public void failedVerificationReturnsFailedAuthenticationStatus() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory());
        VerificationResult vr = mock(VerificationResult.class);
        DiscoveryInformation di = mock(DiscoveryInformation.class);

        when(mgr.verify(anyString(), any(ParameterList.class), any(DiscoveryInformation.class))).thenReturn(vr);

        MockHttpServletRequest request = new MockHttpServletRequest();

        request.getSession().setAttribute(DiscoveryInformation.class.getName(), di);
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

        assertEquals(OpenIDAuthenticationStatus.FAILURE, auth.getStatus());
    }

    @Test
    public void verificationExceptionsRaiseOpenIDException() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory());

        when(mgr.verify(anyString(), any(ParameterList.class), any(DiscoveryInformation.class)))
                .thenThrow(new MessageException(""))
                .thenThrow(new AssociationException(""))
                .thenThrow(new DiscoveryException(""));

        MockHttpServletRequest request = new MockHttpServletRequest();
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

    }

    @SuppressWarnings("serial")
    @Test
    public void successfulVerificationReturnsExpectedAuthentication() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory());
        VerificationResult vr = mock(VerificationResult.class);
        DiscoveryInformation di = mock(DiscoveryInformation.class);
        Identifier id = new Identifier() {
            public String getIdentifier() {
                return "id";
            }
        };
        Message msg = mock(Message.class);

        when(mgr.verify(anyString(), any(ParameterList.class), any(DiscoveryInformation.class))).thenReturn(vr);
        when(vr.getVerifiedId()).thenReturn(id);
        when(vr.getAuthResponse()).thenReturn(msg);

        MockHttpServletRequest request = new MockHttpServletRequest();
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

    private final AxFetchListFactory attributesToFetchFactory;

    //~ Constructors ===================================================================================================

    public OpenID4JavaConsumer() throws ConsumerException {
        this(new ConsumerManager(), new NullAxFetchListFactory());
    }
View Full Code Here

Examples of org.openid4java.consumer.ConsumerManager

    /**
     * @deprecated use the {@link AxFetchListFactory} version instead.
     */
    @Deprecated
    public OpenID4JavaConsumer(List<OpenIDAttribute> attributes) throws ConsumerException {
        this(new ConsumerManager(), attributes);
    }
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.