Examples of AuthRequestHelper


Examples of com.google.step2.AuthRequestHelper

    protected String authRequest(OpenIDAuthenticationRequest request) throws IdentityException {

        try {
            IdpIdentifier openId = new IdpIdentifier(request.getOpenIDUrl());

            AuthRequestHelper helper = consumerHelper.getAuthRequestHelper(openId,
                    request.getReturnUrl());
            addAttributes(helper, request);

            HttpSession session = request.getRequest().getSession();
            AuthRequest authReq = helper.generateRequest();

            UiMessageRequest uiExtension = new UiMessageRequest();
            uiExtension.setIconRequest(true);
            authReq.addExtension(uiExtension);

            session.setAttribute(IdentityConstants.OpenId.DISC, helper.getDiscoveryInformation());

            if (request.getRealm() != null && request.getRealm().trim().length() != 0) {
                authReq.setRealm(request.getRealm());
            }
View Full Code Here

Examples of com.google.step2.AuthRequestHelper

    openid = openid.replaceFirst(".*@", "");

    // we assume that the user typed an identifier for an IdP, not for a user
    IdpIdentifier openId = new IdpIdentifier(openid);

    AuthRequestHelper helper = consumerHelper.getAuthRequestHelper(
        openId, returnToUrl.toString());

    helper.requestUxIcon(true);

    if (YES_STRING.equals(req.getParameter("oauth"))) {
      try {
        OAuthAccessor accessor = providerStore.getOAuthAccessor("google");
        helper.requestOauthAuthorization(accessor.consumer.consumerKey,
            "http://www.google.com/m8/feeds/");
      } catch (ProviderInfoNotFoundException e) {
        log("could not find provider info for Google", e);
        // we'll just ignore the OAuth request and proceed without it.
      }
    }

    if (YES_STRING.equals(req.getParameter("email"))) {
      helper.requestAxAttribute(Step2.AxSchema.EMAIL, true);
    }

    if (YES_STRING.equals(req.getParameter("country"))) {
      helper.requestAxAttribute(Step2.AxSchema.COUNTRY, true);
    }

    if (YES_STRING.equals(req.getParameter("language"))) {
      helper.requestAxAttribute(Step2.AxSchema.LANGUAGE, true);
    }

    if (YES_STRING.equals(req.getParameter("firstName"))) {
      helper.requestAxAttribute(Step2.AxSchema.FIRST_NAME, true);
    }

    if (YES_STRING.equals(req.getParameter("lastName"))) {
      helper.requestAxAttribute(Step2.AxSchema.LAST_NAME, true);
    }

    HttpSession session = req.getSession();
    AuthRequest authReq = null;
    try {
      authReq = helper.generateRequest();
      authReq.setRealm(realm);
      session.setAttribute("discovered", helper.getDiscoveryInformation());
    } catch (DiscoveryException e) {
      throw new ServletException(e);
    } catch (MessageException e) {
      throw new ServletException(e);
    } catch (ConsumerException e) {
View Full Code Here

Examples of com.google.step2.AuthRequestHelper

    openid = openid.replaceFirst(".*@", "");

    // we assume that the user typed an identifier for an IdP, not for a user
    IdpIdentifier openId = new IdpIdentifier(openid);

    AuthRequestHelper helper = consumerHelper.getAuthRequestHelper(
        openId, returnToUrl.toString());

    helper.requestUxIcon(true);

    if (YES_STRING.equals(req.getParameter("oauth"))) {
      try {
        OAuthAccessor accessor = providerStore.getOAuthAccessor("google");
        helper.requestOauthAuthorization(accessor.consumer.consumerKey,
            "http://www.google.com/m8/feeds/");
      } catch (ProviderInfoNotFoundException e) {
        log("could not find provider info for Google", e);
        // we'll just ignore the OAuth request and proceed without it.
      }
    }

    if (YES_STRING.equals(req.getParameter("email"))) {
      helper.requestAxAttribute(Step2.AxSchema.EMAIL, true);
    }

    if (YES_STRING.equals(req.getParameter("country"))) {
      helper.requestAxAttribute(Step2.AxSchema.COUNTRY, true);
    }

    if (YES_STRING.equals(req.getParameter("language"))) {
      helper.requestAxAttribute(Step2.AxSchema.LANGUAGE, true);
    }

    if (YES_STRING.equals(req.getParameter("firstName"))) {
      helper.requestAxAttribute(Step2.AxSchema.FIRST_NAME, true);
    }

    if (YES_STRING.equals(req.getParameter("lastName"))) {
      helper.requestAxAttribute(Step2.AxSchema.LAST_NAME, true);
    }

    HttpSession session = req.getSession();
    AuthRequest authReq = null;
    try {
      authReq = helper.generateRequest();
      authReq.setRealm(realm);
      session.setAttribute("discovered", helper.getDiscoveryInformation());
    } catch (DiscoveryException e) {
      handleDiscoveryFailed(resp);
      return;
    } catch (MessageException e) {
      throw new ServletException(e);
View Full Code Here

Examples of com.google.step2.AuthRequestHelper

    }

    // we assume that the user typed an identifier for an IdP, not for a user
    IdpIdentifier openId = new IdpIdentifier(req.getParameter("openid"));

    AuthRequestHelper helper = consumerHelper.getAuthRequestHelper(
        openId, returnToUrl.toString());

    helper.requestUxIcon(true);

    if (accessor != null) {
      log.debug("Requesting OAuth scope : " +
          (String) accessor.getProperty("scope"));
      helper.requestOauthAuthorization(accessor.consumer.consumerKey,
          (String) accessor.getProperty("scope"));
    }

    if (YES_STRING.equals(req.getParameter("email"))) {
      log.debug("Requesting AX email");
      helper.requestAxAttribute(Step2.AxSchema.EMAIL, true);
    }

    if (YES_STRING.equals(req.getParameter("country"))) {
      log.debug("Requesting AX country");
      helper.requestAxAttribute(Step2.AxSchema.COUNTRY, true);
    }

    if (YES_STRING.equals(req.getParameter("language"))) {
      log.debug("Requesting AX country");
      helper.requestAxAttribute(Step2.AxSchema.LANGUAGE, true);
    }

    if (YES_STRING.equals(req.getParameter("firstName"))) {
      log.debug("Requesting AX country");
      helper.requestAxAttribute(Step2.AxSchema.FIRST_NAME, true);
    }

    if (YES_STRING.equals(req.getParameter("lastName"))) {
      log.debug("Requesting AX country");
      helper.requestAxAttribute(Step2.AxSchema.LAST_NAME, true);
    }

    HttpSession session = req.getSession();
    AuthRequest authReq = null;
    try {
      authReq = helper.generateRequest();
      authReq.setRealm(realm);

      // add PAPE, if requested
      if (YES_STRING.equals(req.getParameter("reauth"))) {
        log.debug("Requesting PAPE reauth");
        PapeRequest pape = PapeRequest.createPapeRequest();
        pape.setMaxAuthAge(1);
        authReq.addExtension(pape);
      }

      session.setAttribute("discovered", helper.getDiscoveryInformation());
    } catch (DiscoveryException e) {
      StringBuffer errorMessage =
        new StringBuffer("Could not discover OpenID endpoint.");
      errorMessage.append("\n\n").append("Check if URL is valid: ");
      errorMessage.append(openId).append("\n\n");
View Full Code Here

Examples of com.google.step2.AuthRequestHelper

        IdpIdentifier openId = new IdpIdentifier(op);

        String realm = realm(request);
        String returnToUrl = returnTo(request);

        AuthRequestHelper helper = consumerHelper.getAuthRequestHelper(openId, returnToUrl);
        addAttributes(helper);

        HttpSession session = request.getSession();
        AuthRequest authReq = helper.generateRequest();
        authReq.setRealm(realm);

        UiMessageRequest uiExtension = new UiMessageRequest();
        uiExtension.setIconRequest(true);
        authReq.addExtension(uiExtension);

        session.setAttribute("discovered", helper.getDiscoveryInformation());
        return authReq;
    }
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.