Package org.openid4java.message.ax

Examples of org.openid4java.message.ax.FetchRequest


        AuthRequest authReq;

        try {
            authReq = consumerManager.authenticate(information, returnToUrl, realm);
            if (!attributesToFetch.isEmpty()) {
                FetchRequest fetchRequest = FetchRequest.createFetchRequest();
                for (OpenIDAttribute attr : attributesToFetch) {
                    fetchRequest.addAttribute(attr.getName(), attr.getType(), attr.isRequired(), attr.getCount());
                }
                authReq.addExtension(fetchRequest);
            }
        } catch (MessageException e) {
            throw new OpenIDConsumerException("Error processing ConsumerManager authentication", e);
View Full Code Here


      // Build the AuthRequest message to be sent to the OpenID provider
      AuthRequest authReq = consumerManager.authenticate(discovered, returnToUrl);

      // Build the FetchRequest containing the information to be copied
      // from the OpenID provider
      FetchRequest fetch = FetchRequest.createFetchRequest();
      // Attempt to decode each entry
      if (identifier.startsWith(GOOGLE_ENDPOINT)) {
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
        fetch.addAttribute("firstName", "http://axschema.org/namePerson/first", true);
        fetch.addAttribute("lastName", "http://axschema.org/namePerson/last", true);
      } else if (identifier.startsWith(YAHOO_ENDPOINT)) {
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
        fetch.addAttribute("fullname", "http://axschema.org/namePerson", true);
      } else { // works for myOpenID
        fetch.addAttribute("fullname", "http://schema.openid.net/namePerson", true);
        fetch.addAttribute("email", "http://schema.openid.net/contact/email", true);
      }

      // Attach the extension to the authentication request
      authReq.addExtension(fetch);
View Full Code Here

            // obtain a AuthRequest message to be sent to the OpenID provider
            AuthRequest authReq = manager.authenticate(discovered, returnToUrl);

            // Attribute Exchange example: fetching the 'email' attribute
            FetchRequest fetch = FetchRequest.createFetchRequest();
            fetch.addAttribute("email", // attribute alias
                    "http://schema.openid.net/contact/email", // type URI
                    true); // required
            // attach the extension to the authentication request
            authReq.addExtension(fetch);
View Full Code Here

            // obtain a AuthRequest message to be sent to the OpenID
            // providerType
            AuthRequest authReq = manager.authenticate(discovered, returnToUrl);

            // Attribute Exchange example: fetching the 'email' attribute
            FetchRequest fetch = FetchRequest.createFetchRequest();
            openIdProvider.prepareRequest(fetch);

            // attach the extension to the authentication request
            authReq.addExtension(fetch);
View Full Code Here

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

      {
         AuthRequest authReq = consumerManager.authenticate(discovered,
               adapter.getReturnURL());

         // Attribute Exchange example: fetching the 'email' attribute
         FetchRequest fetch = FetchRequest.createFetchRequest();
         SRegRequest sregReq = SRegRequest.createFetchRequest();

         OpenIDAttributeMap amap = adapter.getAttributeMap();
        
         if ("1".equals(amap.get("nickname")))
         {
            // fetch.addAttribute("nickname",
            // "http://schema.openid.net/contact/nickname", false);
            sregReq.addAttribute("nickname", false);
         }
        
         if ("1".equals(amap.get("email")))
         {
            fetch.addAttribute("email",OpenIDConstants.EMAIL.url(), false);
            sregReq.addAttribute("email", false);
         }
        
         if ("1".equals(amap.get("fullname")))
         {
            fetch.addAttribute("fullname",OpenIDConstants.FULLNAME.url(), false);
            sregReq.addAttribute("fullname", false);
         }
         if ("1".equals(amap.get("dob")))
         {
            fetch.addAttribute("dob",OpenIDConstants.DOB.url(), true);
            sregReq.addAttribute("dob", false);
         }
        
         if ("1".equals(amap.get("gender")))
         {
            fetch.addAttribute("gender",OpenIDConstants.GENDER.url(), false);
            sregReq.addAttribute("gender", false);
         }
        
         if ("1".equals(amap.get("postcode")))
         {
            fetch.addAttribute("postcode",OpenIDConstants.POSTCODE.url(), false);
            sregReq.addAttribute("postcode", false);
         }
        
         if ("1".equals(amap.get("country")))
         {
            fetch.addAttribute("country",OpenIDConstants.COUNTRY.url(), false);
            sregReq.addAttribute("country", false);
         }
        
         if ("1".equals(amap.get("language")))
         {
            fetch.addAttribute("language", OpenIDConstants.LANGUAGE.url(),false);
            sregReq.addAttribute("language", false);
         }
        
         if ("1".equals(amap.get("timezone")))
         {
            fetch.addAttribute("timezone", OpenIDConstants.TIMEZONE.url(), false);
            sregReq.addAttribute("timezone", false);
         }
        
        
         // attach the extension to the authentication request
View Full Code Here

   */
  public static class EmailDelegate extends EROpenIDManager.DefaultDelegate {
    @Override
    public List<MessageExtension> createFetchMessageExtensions(String userSuppliedString, WORequest request, WOContext context) throws MessageException {
      ArrayList<MessageExtension> exts = new ArrayList<MessageExtension>();
      FetchRequest fetchRequest = FetchRequest.createFetchRequest();
      fetchRequest.addAttribute("email-axschema", "http://axschema.org/contact/email", true);
      fetchRequest.addAttribute("email-openid", "http://schema.openid.net/contact/email", true);
      exts.add(fetchRequest);
      SRegRequest sregRequest = SRegRequest.createFetchRequest();
      sregRequest.addAttribute("email",true);
      exts.add(sregRequest);
      return exts;
View Full Code Here

      AuthRequest auth = consumerManager.authenticate(discoveryInformation, OpenIdSession.get()
          .getOpenIdReturnUrl());

      if (discoveryInformation.getTypes().contains(AxMessage.OPENID_NS_AX)) {
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
        fetch.addAttribute("fullname", "http://axschema.org/namePerson", false);
        fetch.addAttribute("firstname", "http://axschema.org/namePerson/first", false);
        fetch.addAttribute("lastname", "http://axschema.org/namePerson/last", false);
        auth.addExtension(fetch);
      } else if (discoveryInformation.getTypes().contains(SRegMessage.OPENID_NS_SREG)) {
        SRegRequest sregReq = SRegRequest.createFetchRequest();

        sregReq.addAttribute("fullname", true);
View Full Code Here

      AuthRequest auth = consumerManager.authenticate(discoveryInformation, OpenIdSession.get()
          .getOpenIdReturnUrl());

      if (discoveryInformation.getTypes().contains(AxMessage.OPENID_NS_AX)) {
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email", "http://axschema.org/contact/email", true);
        fetch.addAttribute("fullname", "http://axschema.org/namePerson", false);
        fetch.addAttribute("firstname", "http://axschema.org/namePerson/first", false);
        fetch.addAttribute("lastname", "http://axschema.org/namePerson/last", false);
        auth.addExtension(fetch);
      } else if (discoveryInformation.getTypes().contains(SRegMessage.OPENID_NS_SREG)) {
        SRegRequest sregReq = SRegRequest.createFetchRequest();

        sregReq.addAttribute("fullname", true);
View Full Code Here

      {
         AuthRequest authReq = consumerManager.authenticate(discovered,
               adapter.getReturnURL());

         // Attribute Exchange example: fetching the 'email' attribute
         FetchRequest fetch = FetchRequest.createFetchRequest();
         SRegRequest sregReq = SRegRequest.createFetchRequest();

         OpenIDAttributeMap amap = adapter.getAttributeMap();
        
         if ("1".equals(amap.get("nickname")))
         {
            // fetch.addAttribute("nickname",
            // "http://schema.openid.net/contact/nickname", false);
            sregReq.addAttribute("nickname", false);
         }
        
         if ("1".equals(amap.get("email")))
         {
            fetch.addAttribute("email",OpenIDConstants.EMAIL.url(), false);
            sregReq.addAttribute("email", false);
         }
        
         if ("1".equals(amap.get("fullname")))
         {
            fetch.addAttribute("fullname",OpenIDConstants.FULLNAME.url(), false);
            sregReq.addAttribute("fullname", false);
         }
         if ("1".equals(amap.get("dob")))
         {
            fetch.addAttribute("dob",OpenIDConstants.DOB.url(), true);
            sregReq.addAttribute("dob", false);
         }
        
         if ("1".equals(amap.get("gender")))
         {
            fetch.addAttribute("gender",OpenIDConstants.GENDER.url(), false);
            sregReq.addAttribute("gender", false);
         }
        
         if ("1".equals(amap.get("postcode")))
         {
            fetch.addAttribute("postcode",OpenIDConstants.POSTCODE.url(), false);
            sregReq.addAttribute("postcode", false);
         }
        
         if ("1".equals(amap.get("country")))
         {
            fetch.addAttribute("country",OpenIDConstants.COUNTRY.url(), false);
            sregReq.addAttribute("country", false);
         }
        
         if ("1".equals(amap.get("language")))
         {
            fetch.addAttribute("language", OpenIDConstants.LANGUAGE.url(),false);
            sregReq.addAttribute("language", false);
         }
        
         if ("1".equals(amap.get("timezone")))
         {
            fetch.addAttribute("timezone", OpenIDConstants.TIMEZONE.url(), false);
            sregReq.addAttribute("timezone", false);
         }
        
        
         // attach the extension to the authentication request
View Full Code Here

TOP

Related Classes of org.openid4java.message.ax.FetchRequest

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.