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?
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?
Thanks to Matthew Johnson, who helped with the answer:
You need a ClaimsRequest first. Then you can generate a ClaimsResponse with ClaimsRequest.CreateResponse();
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;
}