一千萬個為什麽

搜索

在DotNetOpenAuth中提供SREG/AX的示例


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

ClaimsResponse的所有構造函數都是內部的。 任何幫助/建議?

最佳答案

使用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();
string email = null, fullname = null, nickname = null;
if (claim != null)
{
    email = claim.Email;
    fullname = claim.FullName;
    nickname = claim.Nickname;
}

轉載註明原文: 在DotNetOpenAuth中提供SREG/AX的示例

猜你喜歡