我在DotNetOpenAuth中找不到在Provider(OP)端提供SREG / AX扩展的任何示例。
ClaimsResponse的所有构造函数都是内部的。 任何帮助/建议?
答案 0 :(得分:0)
感谢Matthew Johnson,他帮助了the answer:
您首先需要一个ClaimsRequest。然后 你可以生成一个ClaimsResponse ClaimsRequest.CreateResponse();
答案 1 :(得分:0)
使用ASP.Net MVC,我有:
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;
}