Package org.openid4java.message

Examples of org.openid4java.message.MessageExtension


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


        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
            if (debug) {
                logger.debug("Extracting attributes retrieved by attribute exchange");
            }
            try {
                MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                if (ext instanceof FetchResponse) {
                    FetchResponse fetchResp = (FetchResponse) ext;
                    for (OpenIDAttribute attr : attributesToFetch) {
                        List<String> values = fetchResp.getAttributeValues(attr.getName());
                        if (!values.isEmpty()) {
View Full Code Here

      if (response instanceof DirectError) {
        return directResponse(httpResp, response.keyValueFormEncoding());
      } else {
        if (authReq.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authReq.getExtension(AxMessage.OPENID_NS_AX);
          if (ext instanceof FetchRequest) {
            FetchRequest fetchReq = (FetchRequest) ext;
            Map<?, ?> required = fetchReq.getAttributes(true);
            //Map optional = fetchReq.getAttributes(false);
            if (required.containsKey("email")) {
              Map<Object, Object> userDataExt = new HashMap<>();
              //userDataExt.put("email", userData.get(3));

              FetchResponse fetchResp = FetchResponse.createFetchResponse(fetchReq, userDataExt);
              // (alternatively) manually add attribute values
              fetchResp.addAttribute("email", "http://schema.openid.net/contact/email", email);
              response.addExtension(fetchResp);
            }
          } else {
            throw new UnsupportedOperationException("TODO");
          }
        }
        if (authReq.hasExtension(SRegMessage.OPENID_NS_SREG)) {
          MessageExtension ext = authReq.getExtension(SRegMessage.OPENID_NS_SREG);
          if (ext instanceof SRegRequest) {
            SRegRequest sregReq = (SRegRequest) ext;
            List<?> required = sregReq.getAttributes(true);
            //List optional = sregReq.getAttributes(false);
            if (required.contains("email")) {
View Full Code Here

    if (identifier != null) {
      AuthSuccess authSuccess = AuthSuccess.createAuthSuccess(responseParameters);
      EROpenIDManager.log.debug("AuthSucess:" + authSuccess);

      if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
        MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
        messageExtensions.add(ext);
        EROpenIDManager.log.debug("MessageExtension (AX):" + ext);
        // handle backwards, deprecated compatibility
        if (ext instanceof FetchResponse && fetchResponse == null)
          fetchResponse = (FetchResponse)ext;
      }

      if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
        MessageExtension ext = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG);
        messageExtensions.add(ext);
        EROpenIDManager.log.debug("MessageExtension (SREG):" + ext);
      }

      if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG11)) {
        MessageExtension ext = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG11);
        messageExtensions.add(ext);
        EROpenIDManager.log.debug("MessageExtension (SREG11):" + ext);
      }
    }
View Full Code Here

   */
  public static class DefaultDelegate implements EROpenIDManager.Delegate {

    @SuppressWarnings("unused")
    public List<MessageExtension> createFetchMessageExtensions(String userSuppliedString, WORequest request, WOContext context) throws MessageException {
      MessageExtension fetchRequest = this.createFetchRequest(userSuppliedString, request, context);
      ArrayList<MessageExtension> exts = new ArrayList<MessageExtension>();
      if (fetchRequest != null)
          exts.add(fetchRequest);
      return exts;
    }
View Full Code Here

        OpenIdDetails details = new OpenIdDetails();
        details.setOpenId(verifiedIdentifier.getIdentifier());

        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
              } else {
                fullname = firstname;
              }
            }
            details.setName(fullname);
          }
        } else if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
          MessageExtension extension = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG);
          if (extension instanceof SRegResponse) {
            SRegResponse sRegResponse = (SRegResponse) extension;
            details.setMail(sRegResponse.getAttributeValue("email"));
            details.setName(sRegResponse.getAttributeValue("fullname"));
          }
View Full Code Here

        OpenIdDetails details = new OpenIdDetails();
        details.setOpenId(verifiedIdentifier.getIdentifier());

        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
              } else {
                fullname = firstname;
              }
            }
            details.setName(fullname);
          }
        } else if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
          MessageExtension extension = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG);
          if (extension instanceof SRegResponse) {
            SRegResponse sRegResponse = (SRegResponse) extension;
            details.setMail(sRegResponse.getAttributeValue("email"));
            details.setName(sRegResponse.getAttributeValue("fullname"));
          }
View Full Code Here

        OpenIdDetails details = new OpenIdDetails();
        details.setOpenId(verifiedIdentifier.getIdentifier());

        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
              } else {
                fullname = firstname;
              }
            }
            details.setName(fullname);
          }
        } else if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
          MessageExtension extension = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG);
          if (extension instanceof SRegResponse) {
            SRegResponse sRegResponse = (SRegResponse) extension;
            details.setMail(sRegResponse.getAttributeValue("email"));
            details.setName(sRegResponse.getAttributeValue("fullname"));
          }
View Full Code Here

        OpenIdDetails details = new OpenIdDetails();
        details.setOpenId(verifiedIdentifier.getIdentifier());

        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
              } else {
                fullname = firstname;
              }
            }
            details.setName(fullname);
          }
        } else if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
          MessageExtension extension = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG);
          if (extension instanceof SRegResponse) {
            SRegResponse sRegResponse = (SRegResponse) extension;
            details.setMail(sRegResponse.getAttributeValue("email"));
            details.setName(sRegResponse.getAttributeValue("fullname"));
          }
View Full Code Here

TOP

Related Classes of org.openid4java.message.MessageExtension

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.