如何在DotNetOpenAuth属性交换中使用FavoriteFlavor属性

发布于 2024-10-08 09:12:34 字数 900 浏览 6 评论 0原文

此代码展示了如何使用与 DotNetOpenAuth 的属性交换。

但是,如果我有自己的封闭提供程序并想要使用自定义属性,例如作为 DNOA 示例的一部分在 AcmeRequest 中定义的 FavoriteFlavor 属性,该怎么办?我必须与 DNOA 做什么才能使请求看起来像这样(但对于我的 favoriteflavor 请求):

openid.ns.ax=http://openid.net/srv/ax/1.0
openid.ax.mode=fetch_request
openid.ax.required=name,hackergotchi
openid.ax.if_available=email,web
openid.ax.type.name=http://axschema.org/namePerson
openid.ax.type.email=http://axschema.org/contact/email
openid.ax.type.hackergotchi=http://axschema.org/media/image/default
openid.ax.type.web=http://axschema.org/contact/web/default

http://blogs.gnome.org/jamesh/2007/11/26/openid-ax/

This code shows how to use Attribute Exchange with DotNetOpenAuth.

But what if I have my own closed Provider and want to use custom attributes, for example the FavoriteFlavor attribute defined in the AcmeRequest as part of the DNOA samples; what do I have to do with DNOA to make the request look like something like (but for my FavoriteFlavor request):

openid.ns.ax=http://openid.net/srv/ax/1.0
openid.ax.mode=fetch_request
openid.ax.required=name,hackergotchi
openid.ax.if_available=email,web
openid.ax.type.name=http://axschema.org/namePerson
openid.ax.type.email=http://axschema.org/contact/email
openid.ax.type.hackergotchi=http://axschema.org/media/image/default
openid.ax.type.web=http://axschema.org/contact/web/default

as defined in http://blogs.gnome.org/jamesh/2007/11/26/openid-ax/:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

匿名。 2024-10-15 09:12:34

我不确定当您构建自己的 OpenID 提供程序时是否需要使 OpenID 请求与此完全相同。

您只需要使用 Fetch 和 Store(如果您想允许保存数据)请求和响应,非常简单。

IAuthenticationRequest request)

var ax = new FetchRequest();
ax.Attributes.AddRequired("http://axschema.org/contact/email");
ax.Attributes.AddRequired("http://axschema.org/namePerson");

request.AddExtension(ax);

在 OpendID 提供程序上,您必须捕获此请求并创建 FetchResponse

var fetchRequest = pendingRequest.GetExtension<FetchRequest>();

var fetchResponse = new FetchResponse();
fetchResponse.Attributes.Add("http://axschema.org/contact/email", "[email protected]");
fetchResponse.Attributes.Add("http://axschema.org/namePerson", "John");

pendingRequest.AddResponseExtension(fetchResponse);

请记住,这些只是属性交换扩展所需的附加步骤。

I am not sure that you need to make the OpenID request look exactly like this when you are building your own OpenID provider.

You only need to use Fetch and Store (if you want to allowing saving of data) requests and response and it is very simple.

IAuthenticationRequest request)

var ax = new FetchRequest();
ax.Attributes.AddRequired("http://axschema.org/contact/email");
ax.Attributes.AddRequired("http://axschema.org/namePerson");

request.AddExtension(ax);

On the OpendID provider you have to catch this request and create FetchResponse

var fetchRequest = pendingRequest.GetExtension<FetchRequest>();

var fetchResponse = new FetchResponse();
fetchResponse.Attributes.Add("http://axschema.org/contact/email", "[email protected]");
fetchResponse.Attributes.Add("http://axschema.org/namePerson", "John");

pendingRequest.AddResponseExtension(fetchResponse);

Keep in mind that these are just sort of additional steps needed for Attribute Exchange extension.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文