Package org.openid4java.consumer

Examples of org.openid4java.consumer.VerificationResult


         if (queryString != null && queryString.length() > 0)
            receivingURL.append("?").append(httpRequest.getQueryString());

         // verify the response; ConsumerManager needs to be the same
         // (static) instance used to place the authentication request
         VerificationResult verification = openIdConsumerManager.verify(
               receivingURL.toString(), parameterList, discovered);

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

         if (identifier != null)
         {
            AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();

            Map<String, List<String>> attributeValues = null;
            if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX))
            {
               FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
               @SuppressWarnings("unchecked")
               Map<String, List<String>> attrValues = fetchResp.getAttributes();
               attributeValues = attrValues;
            }

            OpenIdPrincipal principal = createPrincipal(identifier.getIdentifier(),
                  discovered.getOPEndpoint(), attributeValues);

            openIdRelyingPartySpi.get().loginSucceeded(principal,
                  responseHandler.createResponseHolder(httpResponse));
         }
         else
         {
            openIdRelyingPartySpi.get().loginFailed(verification.getStatusMsg(),
                  responseHandler.createResponseHolder(httpResponse));
         }
      }
      catch (OpenIDException e)
      {
View Full Code Here


            StringBuffer receivingURL = request.getRequestURL();
            String queryString = request.getQueryString();
            if( queryString != null && queryString.length() > 0 )
                receivingURL.append("?").append(queryString);
            VerificationResult verification = manager.verify(receivingURL.toString(), openidResp, discovered);

            Identifier verified = verification.getVerifiedId();
            String openid = null;
           
            if( verified != null ){
                AuthSuccess authSuccess = (AuthSuccess)verification.getAuthResponse();
                /*
                 * This piece of code does not work with blogspot.com while it works well
                 * with myopenid.com.
                request.setAttribute("opendpoint", authSuccess.getOpEndpoint());
                request.setAttribute("claimed", authSuccess.getClaimed());
View Full Code Here

            }

            // verify the response; ConsumerManager needs to be the same
            // (static) instance used to place the authentication request

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

            // examine the verification result and extract the verified
            // identifier

            final Identifier verified = verification.getVerifiedId();
            if (verified != null) {
                final AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    final FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                    final String email = fetchResp.getAttributeValue("email");
                    final String lastname = fetchResp.getAttributeValue("LastName");
                    final String firstname = fetchResp.getAttributeValue("FirstName");
View Full Code Here

            throws OpenIDException, IdentityException {

        DiscoveryInformation discovered = null;
        String receivingURL = null;
        String queryString = null;
        VerificationResult verification = null;
        Identifier verified = null;
        HttpSession session = null;

        session = request.getSession();
View Full Code Here

    // from repeating discovery later, and will allow us to modify the
    // VerificationResult depending on whether the discovery was secure.
    SecureDiscoveryInformation d2 = getDiscoveryInfoForClaimedId(authResponse,
        discovered);

    VerificationResult verification =
      consumerManager.verify(receivingUrl, authResponse, d2);

    // the only indication that something went wrong during nonce and
    // signature checking is if the returned identity is null. In that case,
    // we don't even want to return anything.
    if ((verification.getAuthResponse() instanceof AuthSuccess)
        && (verification.getVerifiedId() == null)) {
      throw new VerificationException("something went wrong during " +
          "response verification, such as nonce or signature checking. " +
          "Check your debug logs.");
    }
View Full Code Here

            log.info("OpenID disc : " + discovered.getOPEndpoint());
            log.info("OpenID orig ref : " + getOriginalRef());
            ConsumerManager manager = getManager(discovered.getOPEndpoint()
                    .toString());

            VerificationResult verification = manager.verify(getOriginalRef()
                    .toString(), response, discovered);
            log.info("verification = " + verification);

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

                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchRequest fetchResp = (FetchRequest) authSuccess
                            .getExtension(AxMessage.OPENID_NS_AX);
View Full Code Here

            ConsumerManager manager = getManager(discovered.getOPEndpoint()
                    .toString());
            String redir = request.getResourceRef().getHostIdentifier()
                    + request.getResourceRef().getPath() + "?return=true";

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

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

                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchResponse fetchResp = (FetchResponse) authSuccess
                            .getExtension(AxMessage.OPENID_NS_AX);
View Full Code Here

            if (queryString != null && queryString.length() > 0)
                receivingURL.append("?").append(httpReq.getQueryString());

            // verify the response; ConsumerManager needs to be the same
            // (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();

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

                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX))
View Full Code Here

      //
      state.retTo.put("openid.rpnonce", req.getParameter("openid.rpnonce"));
      state.retTo.put("openid.rpsig", req.getParameter("openid.rpsig"));
    }

    final VerificationResult result =
        manager.verify(state.retTo.toString(), new ParameterList(req
            .getParameterMap()), state.discovered);
    if (result.getVerifiedId() == null /* authentication failure */) {
      if ("Nonce verification failed.".equals(result.getStatusMsg())) {
        // We might be suffering from clock skew on this system.
        //
        log.error("OpenID failure: " + result.getStatusMsg()
            + "  Likely caused by clock skew on this server,"
            + " install/configure NTP.");
        cancelWithError(req, rsp, result.getStatusMsg());

      } else if (result.getStatusMsg() != null) {
        // Authentication failed.
        //
        log.error("OpenID failure: " + result.getStatusMsg());
        cancelWithError(req, rsp, result.getStatusMsg());

      } else {
        // Assume authentication was canceled.
        //
        cancel(req, rsp);
      }
      return;
    }

    final Message authRsp = result.getAuthResponse();
    SRegResponse sregRsp = null;
    FetchResponse fetchRsp = null;

    if (0 <= papeMaxAuthAge) {
      PapeResponse ext;
View Full Code Here

                receivingURL.append("?").append(httpReq.getQueryString());
           
           
            // verify the response; ConsumerManager needs to be the same
            // (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)) {
View Full Code Here

TOP

Related Classes of org.openid4java.consumer.VerificationResult

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.