Examples of AuthResponseHelper


Examples of com.google.step2.AuthResponseHelper

        if (log.isDebugEnabled()) {
            log.debug("OpenID receiving url from the reponse: " + receivingURL);
            log.debug("OpenID query string from the reponse: " + queryString);
        }

        AuthResponseHelper authResponse = consumerHelper.verify(receivingURL, openidResp,
                discovered);
        if (authResponse.getAuthResultType() == AuthResponseHelper.ResultType.AUTH_SUCCESS) {
            return authResponse.getAuthResponse();
        } else {
            log.error("OpenID verification failed");
            throw new IdentityException("OpenID verification failed");
        }
View Full Code Here

Examples of com.google.step2.AuthResponseHelper

    String requestToken = NO_TOKEN;

    // Try to get the OpenId, AX, and OAuth values from the auth response
    try {
      AuthResponseHelper authResponse =
        helper.verify(receivingUrl, openidResp, discovered);

      // Clean up stale session state if any
      for (Step2.AxSchema schema : SUPPORTED_AX_SCHEMAS) {
        session.removeAttribute(schema.getShortName());
      }
      session.removeAttribute("request_token");
      session.removeAttribute("access_token");
      session.removeAttribute("access_token_secret");
      session.removeAttribute("accessor");
      session.removeAttribute("user");

      // Get Claimed Identifier
      Identifier claimedId = authResponse.getClaimedId();
      session.setAttribute("user",
          (claimedId == null) ? UNKNOWN : claimedId.getIdentifier());


      if (authResponse.getAuthResultType() == ResultType.SETUP_NEEDED) {
        throw new ServletException("setup needed");
      }

      if (authResponse.getAuthResultType() == ResultType.AUTH_FAILURE) {
        throw new ServletException("auth failure");
      }

      if (authResponse.getAuthResultType() == ResultType.AUTH_SUCCESS) {
        Class<? extends AxMessage> axExtensionType =
            authResponse.getAxExtensionType();
        if (axExtensionType != null) {
          if (axExtensionType.equals(FetchResponse.class)) {
            FetchResponse fetchResponse = authResponse.getAxFetchResponse();
            List<String> aliases = fetchResponse.getAttributeAliases();
            for (String alias : aliases) {
              String typeUri = fetchResponse.getAttributeTypeUri(alias);
              String value = fetchResponse.getAttributeValueByTypeUri(typeUri);

              // check if it's a known type
              Step2.AxSchema schema = Step2.AxSchema.ofTypeUri(typeUri);
              if (null != schema) {
                session.setAttribute(schema.getShortName(), value);
              } else {
                session.setAttribute(alias + " (" + typeUri + ")", value);
              }
            }
          }
        }
        if (authResponse.hasHybridOauthExtension()) {
          requestToken = authResponse.getHybridOauthResponse().getRequestToken();
          session.setAttribute("request_token", "yes (" + requestToken + ")");
        }
      }
    } catch (MessageException e) {
      throw new ServletException(e);
View Full Code Here

Examples of com.google.step2.AuthResponseHelper

        String receivingUrl = currentUrl(request);
        DiscoveryInformation discovered =
                (DiscoveryInformation) session.getAttribute("discovered");


        AuthResponseHelper authResponse =
                consumerHelper.verify(receivingUrl, openidResp, discovered);
        if (authResponse.getAuthResultType() == AuthResponseHelper.ResultType.AUTH_SUCCESS) {
            return onSuccess(authResponse, request);
        }
        return onFail(authResponse, request);
    }
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.