Package org.openid4java.consumer

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


        }
    }

    @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

        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

    }

    @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

    private final AxFetchListFactory attributesToFetchFactory;

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

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

    /**
     * @deprecated use the {@link AxFetchListFactory} version instead.
     */
    @Deprecated
    public OpenID4JavaConsumer(List<OpenIDAttribute> attributes) throws ConsumerException {
        this(new ConsumerManager(), attributes);
    }
View Full Code Here

            }
        };
    }

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

        try {
            //The ConsumerManager class is frustrating - at the time of this implementation
            //(2011.02.18), this constructor's source code never throws a ConsumerException - probably left in
            //place to be backwards compatible with a previous release that did throw that exception.
            //Another failing of checked exceptions and not programming to interfaces...
            this.consumerManager = new ConsumerManager();
        } catch (ConsumerException e) {
            throw new IllegalStateException(e);
        }
    }
View Full Code Here

   }

   @Inject
   public void startup() throws Exception
   {
      consumerManager = new ConsumerManager();
   }
View Full Code Here

            SREFilename = context.getRealPath(SREFilename);
            AXFilename = context.getRealPath(AXFilename);
            srestore = new OpenIDSREStore(SREFilename);
            axstore = new OpenIDAXStore(AXFilename);

            this.manager = new ConsumerManager();
            DummyRealmVerifier rv = new DummyRealmVerifier();
            rv.setEnforceRpId(false);
            this.manager.setRealmVerifier(rv);
        } catch (ConsumerException e) {
            throw new ServletException(e);
View Full Code Here

TOP

Related Classes of org.openid4java.consumer.ConsumerManager

Copyright © 2018 www.massapicom. 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.