views:

38

answers:

1

So here's some code on the request:-

                IAuthenticationRequest req = openid.CreateRequest(Request.Form["openid_identifier"]);


                //add extention requests here
                req.AddExtension(new ClaimsRequest
                    {
                        Email = DemandLevel.Request,
                        BirthDate = DemandLevel.Request,
                        Country = DemandLevel.Request,
                        FullName = DemandLevel.Request,
                        Gender = DemandLevel.Request,
                        Language = DemandLevel.Request,
                        Nickname = DemandLevel.Request,
                        PostalCode = DemandLevel.Request,
                        TimeZone = DemandLevel.Request
                    }
                );

                //get the request from openid
                return req.RedirectingResponse.AsActionResult();

And here's some on the pickup:-

                        //get attributes from site
                        var sreg = response.GetExtension<ClaimsResponse>();

                        string sreg_email = "Unknown Email";
                        DateTime sreg_birthdate;
                        string sreg_birthdateraw;
                        Gender sreg_gender;
                        Version sreg_version;
                        string sreg_timezone;
                        string sreg_nickname;
                        string sreg_postalcode;
                        System.Globalization.CultureInfo sreg_culture;
                        string sreg_country;
                        string sreg_fullname;
                        System.Net.Mail.MailAddress sreg_mailaddress;
                        string sreg_language;

                        if (sreg != null)
                        {
                            sreg_email = sreg.Email;
                            sreg_birthdate = sreg.BirthDate.Value;
                            sreg_birthdateraw = sreg.BirthDateRaw;
                            sreg_country = sreg.Country;
                            sreg_culture = sreg.Culture;
                            sreg_fullname = sreg.FullName;
                            sreg_gender = sreg.Gender.Value;
                            sreg_language = sreg.Language;
                            sreg_mailaddress = sreg.MailAddress;
                            sreg_nickname = sreg.Nickname;
                            sreg_postalcode = sreg.PostalCode;
                            sreg_timezone = sreg.TimeZone;
                            sreg_version = sreg.Version;
                        }

But it's all coming back as null no matter which OpenId provider I use...

Am I missing something obvious?

Rob

A: 

Have you turned on the AXFetchAsSregTransform? Also, some Providers won't give you any information unless RP discovery works on your site and/or you publish a privacy policy in your ClaimsRequest, which I don't see in your code.

Some Providers just don't provide data. But MyOpenID.com is one provider that ought to work for your existing site and code (as it doesn't have the extra restrictions I listed last I checked). Have you tested against MyOpenID.com?

Andrew Arnott
Hi Andrew, thanks for the pointers. I haven't tried them yet but I will asap.
Rob Ellis
Hi Andrew - yes, MyOpenID works exactly for the code (as long as you've set up a Persona). I'm going to look at the impact of AXFetchAsSregTransform.
Rob Ellis