Examples of FetchResponse


Examples of org.openid4java.message.ax.FetchResponse

        List<OpenIDAttribute> attributes = Collections.emptyList();

        try {
            MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
            if (ext instanceof FetchResponse) {
                FetchResponse fetchResp = (FetchResponse) ext;
                attributes = new ArrayList<OpenIDAttribute>(attributesToFetch.size());

                for (OpenIDAttribute attr : attributesToFetch) {
                    List<String> values = fetchResp.getAttributeValues(attr.getName());
                    if (!values.isEmpty()) {
                        OpenIDAttribute fetched = new OpenIDAttribute(attr.getName(), attr.getType(), values);
                        fetched.setRequired(attr.isRequired());
                        attributes.add(fetched);
                    }
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

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

Examples of org.openid4java.message.ax.FetchResponse

      {
         if (openIdProviderRequest.get().getRequestedAttributes() != null)
         {
            try
            {
               FetchResponse fetchResponse = FetchResponse.createFetchResponse(openIdProviderRequest.get().getFetchRequest(), attributeValues);
               authResponse.addExtension(fetchResponse);
            }
            catch (MessageException e)
            {
               throw new RuntimeException(e);
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

                        request.setAttribute(sregmapAttrName,  sregmap);
                    }
                }

                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                    logger.info("resp contains AX extension");

                    request.setAttribute(axmapAttrName, fetchResp.getAttributes());
                    List aliases = fetchResp.getAttributeAliases();
                    for (Iterator iter = aliases.iterator(); iter.hasNext();) {
                            String alias = (String) iter.next();
                            List values = fetchResp.getAttributeValues(alias);
                            if (values.size() > 0) {
                                logger.info(alias+":"+values.get(0));
                            }
                    }
                }
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

            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");
                    final String fullname = fetchResp.getAttributeValue("fullname");
                    final HttpSession session = request.getSession();
                    if (fullname == null) {
                        session.setAttribute("username", firstname + " " + lastname);
                    }
                    else {
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

   */
  public void setSessionAttributes(List<ClaimDTO> claimList) throws IdentityException {

    List aliases = null;
    List values = null;
    FetchResponse fetchReponse = null;
    Map attributeTypes = null;
    ClaimDTO claim = null;

    try {

      if (authSuccess.hasExtension(FetchResponse.OPENID_NS_AX)) {
        fetchReponse = (FetchResponse) authSuccess.getExtension(FetchResponse.OPENID_NS_AX);
        aliases = fetchReponse.getAttributeAliases();
        attributeTypes = fetchReponse.getAttributeTypes();       

        for (Object alias : aliases) {
          values = fetchReponse.getAttributeValues((String) alias);
          if (values != null && !values.isEmpty()) {
            claim = new ClaimDTO();
            claim.setClaimUri((String) attributeTypes.get(alias));
            claim.setClaimValue((String) values.get(0));
            claimList.add(claim);
          }
        }
      } else if (authSuccess.hasExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX)) {
        fetchReponse = (FetchResponse) authSuccess
            .getExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX);
        aliases = fetchReponse.getAttributeAliases();
        attributeTypes = fetchReponse.getAttributeTypes();

        for (Object alias : aliases) {
          values = fetchReponse.getAttributeValues((String) alias);
          if (values != null && !values.isEmpty()) {
            claim = new ClaimDTO();
            claim.setClaimUri((String) attributeTypes.get(alias));
            claim.setClaimValue((String) values.get(0));
            claimList.add(claim);
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

   * @param alias the alias under which the attribute was requested.
   * @return list of attribute values.
   *
   */
  public List<String> getAxFetchAttributeValues(String alias) {
    FetchResponse resp;
    try {
      resp = getAxFetchResponse();
    } catch (MessageException e) {
      return Collections.emptyList();
    }

    // when the parameter is not there, then the library returns a list of
    // length 1 with null as its only member. Go figure.
    @SuppressWarnings("unchecked")
    List<String> result = resp.getAttributeValues(alias);

    if ((result.size() == 1) && (null == result.get(0))) {
      return Collections.emptyList();
    } else {
      return result;
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

   */
  public MessageExtension getMessageExtension(String userId, String profileName)
      throws IdentityException {
    MessageExtension extensions = null;
    AuthRequest authRequest = null;
    FetchResponse fetchResponse = null;

    try {
      authRequest = request.getAuthRequest();
      if (authRequest.hasExtension(FetchRequest.OPENID_NS_AX)) {
        extensions = authRequest.getExtension(FetchRequest.OPENID_NS_AX);
View Full Code Here

Examples of org.openid4java.message.ax.FetchResponse

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

Examples of org.openid4java.message.ax.FetchResponse

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

                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchResponse fetchResp = (FetchResponse) authSuccess
                            .getExtension(AxMessage.OPENID_NS_AX);

                    MessageExtension ext = authSuccess
                            .getExtension(AxMessage.OPENID_NS_AX);
                    if (ext instanceof FetchResponse) {
                        List<String> aliases = fetchResp.getAttributeAliases();
                        for (String alias : aliases) {
                            String value = fetchResp.getAttributeValue(alias);
                            axResp.put(AX.valueOf(alias), value);
                        }
                    }
                }
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.