Package org.openid4java.discovery

Examples of org.openid4java.discovery.Identifier


            VerificationResult verification = manager.verify(
                    receivingURL.toString(),
                    response, discovered);

            // examine the verification result and extract the verified identifier
            Identifier verified = verification.getVerifiedId();
            if (verified != null)
            {
                AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();

                HttpSession session = httpReq.getSession(true);
View Full Code Here


        // asserted identifier in the AuthResponse
        String assertId = authResp.getIdentity();

        // claimed identifier
        Identifier claimedId = discovered.getClaimedIdentifier();

        if (DEBUG)
            _log.debug("Verifying discovered information for OpenID1 assertion " +
                       "about ClaimedID: " + claimedId.getIdentifier());

        // OP-specific ID
        String opSpecific = discovered.hasDelegateIdentifier() ?
                discovered.getDelegateIdentifier() : claimedId.getIdentifier();

        // does the asserted ID match the OP-specific ID from the discovery?
        if ( opSpecific.equals(assertId) )
            return discovered;  // success
View Full Code Here

        // asserted identifier in the AuthResponse
        String assertId = authResp.getIdentity();

        // claimed identifier in the AuthResponse
        Identifier respClaimed = Discovery.parseIdentifier(authResp.getClaimed());

        // the OP endpoint sent in the response
        String respEndpoint = authResp.getOpEndpoint();

        if (DEBUG)
            _log.debug("Verifying discovered information for OpenID2 assertion " +
                       "about ClaimedID: " + respClaimed.getIdentifier());


        // was the claimed identifier in the assertion previously discovered?
        if (discovered != null && discovered.hasClaimedIdentifier() &&
                discovered.getClaimedIdentifier().equals(respClaimed) )
View Full Code Here

                result.setStatusMsg("Error verifying signature with the OP: "
                                    + err.getErrorMsg());
            }
        }

        Identifier verifiedID = result.getVerifiedId();
        if (verifiedID != null)
            _log.info("Verification succeeded for: " + verifiedID);

        else
            _log.error("Verification failed for: " + verifiedID
View Full Code Here

            VerificationResult verification = manager.verify(
                    receivingURL.toString(),
                    response, discovered);

            // examine the verification result and extract the verified identifier
            Identifier verified = verification.getVerifiedId();
            if (verified != null)
            {
                AuthSuccess authSuccess =
                        (AuthSuccess) verification.getAuthResponse();
View Full Code Here

            // (static) instance used to place the authentication request
            VerificationResult verification = manager.verify(receivingURL.toString(),
                                                             response, discovered);
           
            // examine the verification result and extract the verified identifier
            Identifier verified = verification.getVerifiedId();
            if (verified != null) {
//                AuthSuccess authSuccess =
//                    (AuthSuccess) verification.getAuthResponse();
               
//                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
//                    FetchResponse fetchResp = (FetchResponse) authSuccess
//                        .getExtension(AxMessage.OPENID_NS_AX);
//                   
//                    List emails = fetchResp.getAttributeValues("email");
//                    String email = (String) emails.get(0);
//                }
               
                return verified.getIdentifier();
            }
        } catch (OpenIDException e) {
            // present error to the user
        }
       
View Full Code Here

            // verify the response
            final VerificationResult verification = this.consumerManager.verify(contextualCallbackUrl, parameterList,
                    discoveryInformation);

            // examine the verification result and extract the verified identifier
            final Identifier verified = verification.getVerifiedId();
            if (verified != null) {
                final AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
                logger.debug("authSuccess : {}", authSuccess);

                final U profile = createProfile(authSuccess);
                profile.setId(verified.getIdentifier());
                logger.debug("profile : {}", profile);
                return profile;
            }
        } catch (final OpenIDException e) {
            logger.error("OpenID exception", e);
View Full Code Here

      System.out.println("actual verify");
      VerificationResult verification = manager.verify(receivingURL.toString(), responseParams, null);
      // examine the verification result and extract the verified
      // identifier
      System.out.println("getting verified id");
      Identifier id = verification.getVerifiedId();
     
      if (id != null) {
        System.out.println("id found");
        UserDetails userDetails = new UserDetails();
        userDetails.setUniqueId(HttpCookies.getCookieValue(request, uniqueIdCookieName));
        userDetails.setOpenId(id.getIdentifier());
        AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
        System.out.println("retrieved auth response");
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          System.out.println("doing stuff for auth extension");
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;
            System.out.println("adding attributes to user details");
            userDetails = addAttributes(fetchResp, userDetails);
          }

        }
        System.out.println("setting id cookie");
        HttpCookies.setCookie(request, response, openIdCookieName, id.getIdentifier());
        System.out.println("saving identifies for unique id");
        callback.saveIdentifierForUniqueId(new File(getServletContext().getRealPath("/")), userDetails);
      } else {
        System.out.println("id not found");
      }
View Full Code Here

                logger.debug("Retrieved attributes" + attributes);
            }
        }

        // examine the verification result and extract the verified identifier
        Identifier verified = verification.getVerifiedId();

        if (verified == null) {
            Identifier id = discovered.getClaimedIdentifier();
            return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE,
                    id == null ? "Unknown" : id.getIdentifier(),
                    "Verification status message: [" + verification.getStatusMsg() + "]", attributes);
        }

        return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS, verified.getIdentifier(),
                        "some message", attributes);
View Full Code Here

            VerificationResult verification = manager.verify(
                    receivingURL.toString(),
                    response, discovered);

            // examine the verification result and extract the verified identifier
            Identifier verified = verification.getVerifiedId();
            if (verified != null) {
                AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();

                HttpSession session = httpReq.getSession(true);
                session.setAttribute("openid_identifier", authSuccess.getIdentity());
View Full Code Here

TOP

Related Classes of org.openid4java.discovery.Identifier

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.