Package org.openid4java.consumer

Examples of org.openid4java.consumer.ConsumerManager.authenticate()


    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();
View Full Code Here


    @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

            getResponse().getCookieSettings().add(
                    new CookieSetting(DESCRIPTOR_COOKIE, sessionId));
            log.info("Setting DESCRIPTOR COOKIE");

            // obtain a AuthRequest message to be sent to the OpenID provider
            AuthRequest authReq = manager.authenticate(discovered,
                    returnToUrl.toString()); // TODO maybe add TIMESTAMP?
            // Domain wide realm add meta to main page
            // http://localhost:8080/oauth/xrds?returnTo=http://localhost:8080/oauth/openid_login\r\n
            // log.info("OpenID - REALM = " +
            // getReference().getHostIdentifier());
View Full Code Here

        response.getCookieSettings().add(
                new CookieSetting(OpenIdConsumer.DESCRIPTOR_COOKIE, sessionId));
        l.info("Setting DESCRIPTOR COOKIE");

        // obtain a AuthRequest message to be sent to the OpenID provider
        AuthRequest authReq = manager.authenticate(discovered, redir); // TODO
                                                                       // maybe
                                                                       // add
                                                                       // TIMESTAMP?;
        String ref = request.getResourceRef().getBaseRef().toString();
        l.info("OpenID - REALM = " + ref);
View Full Code Here

      // Persist the User
      InMemoryUserCache.INSTANCE.put(sessionToken, tempUser);

      // Build the AuthRequest message to be sent to the OpenID provider
      AuthRequest authReq = consumerManager.authenticate(discovered, returnToUrl);

      // Build the FetchRequest containing the information to be copied
      // from the OpenID provider
      FetchRequest fetch = FetchRequest.createFetchRequest();
      // Attempt to decode each entry
View Full Code Here

  private AuthRequest createOpenIdAuthRequest() {
    try {
      ConsumerManager consumerManager = OpenIdSession.get().getConsumerManager();

      AuthRequest auth = consumerManager.authenticate(discoveryInformation, OpenIdSession.get()
          .getOpenIdReturnUrl());

      if (discoveryInformation.getTypes().contains(AxMessage.OPENID_NS_AX)) {
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
View Full Code Here

  private AuthRequest createOpenIdAuthRequest() {
    try {
      ConsumerManager consumerManager = OpenIdSession.get().getConsumerManager();

      AuthRequest auth = consumerManager.authenticate(discoveryInformation, OpenIdSession.get()
          .getOpenIdReturnUrl());

      if (discoveryInformation.getTypes().contains(AxMessage.OPENID_NS_AX)) {
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
View Full Code Here

  private AuthRequest createOpenIdAuthRequest() {
    try {
      ConsumerManager consumerManager = OpenIdSession.get().getConsumerManager();

      AuthRequest auth = consumerManager.authenticate(discoveryInformation, OpenIdSession.get()
          .getOpenIdReturnUrl());

      if (discoveryInformation.getTypes().contains(AxMessage.OPENID_NS_AX)) {
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
View Full Code Here

  private AuthRequest createOpenIdAuthRequest() {
    try {
      ConsumerManager consumerManager = OpenIdSession.get().getConsumerManager();

      AuthRequest auth = consumerManager.authenticate(discoveryInformation, OpenIdSession.get()
          .getOpenIdReturnUrl());

      if (discoveryInformation.getTypes().contains(AxMessage.OPENID_NS_AX)) {
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
View Full Code Here

                    String authReturnToURL = openIDRealmURL+"/"+OpenIDConstants.OPEN_ID_AUTHENTICATED_REQUEST+"?"+OpenIDConstants.OPEN_ID_RETURN+"="+returnPath;
                    String authRedirectURL = null;
                    try
                    {
                        // authentication request
                        AuthRequest authRequest = providerOpenIDConsumerManager.authenticate(discovered, authReturnToURL, openIDRealmURL);
                        // request attribute exchange data
                        FetchRequest axRequest = FetchRequest.createFetchRequest();
                        axRequest.addAttribute("email", "http://axschema.org/contact/email", true);
                        axRequest.addAttribute("fullname", "http://axschema.org/namePerson", true);
                        axRequest.addAttribute("lastname", "http://axschema.org/namePerson/last", true);
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.