0

我在 DotNetOpenAuth 的提供者 (OP) 端找不到任何提供 SREG/AX 扩展的示例。

ClaimsResponse 的所有构造函数都是内部的。有什么帮助/建议吗?

4

2 回答 2

0

感谢 Matthew Johnson 帮助解答

您首先需要一个 ClaimsRequest。然后您可以使用 ClaimsRequest.CreateResponse() 生成 ClaimsResponse;

于 2010-05-04T07:44:23.287 回答
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;
}
于 2010-05-12T03:26:50.013 回答