且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用DotNetOpenAuth在OpenID身份验证请求中包括AX扩展

更新时间:2023-12-03 18:38:10

如果您只是想获取标准属性,建议您阅读有关 AXFetchAsSregTransform 的文章,该文章隐藏了AX和从您的站点收集SREG属性。

If you are just trying to get standard attributes, I recommend you read about the AXFetchAsSregTransform which hides the complexity of AX and SREG attribute gathering from your site.

如果您正在执行自定义操作,并且知道需要请求哪些AX属性,则示例代码如下:

If you are doing something custom and know what AX attributes you need to request, here is sample code:

var rp = new OpenIdRelyingParty();
var request = rp.CreateRequest("=some*identifier");
var ax = new FetchRequest();
ax.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
request.AddExtension(ax);
request.RedirectToProvider();