Question

I can't find any example of supplying SREG/AX extension on Provider (OP) side in DotNetOpenAuth.

All constructors of ClaimsResponse are internal. Any help/suggestions?

Was it helpful?

Solution

Thanks to Matthew Johnson, who helped with the answer:

You need a ClaimsRequest first. Then you can generate a ClaimsResponse with ClaimsRequest.CreateResponse();

OTHER TIPS

Using ASP.Net MVC, I have:

private static OpenIdRelyingParty openid = new OpenIdRelyingParty();

var req = openid.CreateRequest(Request.Form["openid_identifier"]);
var fields = new ClaimsRequest();                       
fields.Email = DemandLevel.Request;
fields.FullName = DemandLevel.Request;
fields.Nickname = DemandLevel.Request;
req.AddExtension(fields);

// make the request and your response will now contain the fields

var claim = response.GetExtension<ClaimsResponse>();
string email = null, fullname = null, nickname = null;
if (claim != null)
{
    email = claim.Email;
    fullname = claim.FullName;
    nickname = claim.Nickname;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top