DotNetOpenAuth IAuthenticationRequest 成员解释请求
我开始使用 DotNetOpenAuth 并想了解 IAuthenticationRequest 接口的以下成员的含义以及应如何使用它们:
IsDelegatedIdentifier: bool
IsDirectedIdentity: bool
以及继承的 IHostProcessedRequest 接口:
Immediate: bool
请有人提供一个简短的解释?谢谢。
I'm beginning to use DotNetOpenAuth and want to understand what the following members of the IAuthenticationRequest interface are meant for and how they should be used:
IsDelegatedIdentifier: bool
IsDirectedIdentity: bool
And from the inherited IHostProcessedRequest interface:
Immediate: bool
Please would someone provide a brief explanation? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些都是直接来自 OpenID 2.0 规范 的概念,因此您可以参考那里完整的答案。顺便说一下,DotNetOpenAuth 中包含一个 .chm 文档文件,它也记录了这些成员。
但这是您所要求的:
IsDelegateIdentifier
一个值,指示用户是否托管自己的 OpenID 标识符,然后将其委托给您的提供商。通常不需要您做任何特别的事情,因为 DotNetOpenAuth 会为您处理一切。但是如果您有不允许授权的政策,这将提供一种方式。IsDirectedIdentity
一个值,指示用户/RP 是否已经知道他们期望取回的声明标识符。如果false
,他们已经知道,您(提供商)只需验证登录用户是否控制该标识符;如果true
您需要作为 Provider 来确定哪个用户已登录,并将 ClaimedIdentifier 属性设置为适合该用户的值。立即
一个值,指示您是否必须立即做出批准或拒绝 RP 请求的决定。如果true
不允许您与用户交互,您可能不会显示 UI,您只能根据您的决定重定向回 RP。如果false
你可以要求用户登录,要求他们确认等。在立即模式下,如果你不能确定用户是谁或者用户是否信任RP,你应始终返回拒绝响应。当 RP 根本不需要声明的标识符,而是只想响应 OpenID 请求扩展时,
IAnonymousRequest
会代替IAuthenticationRequest
出现。都包括在内。换句话说,他们不想知道用户是谁,他们只想了解有关他们的一些信息。此类请求在 OpenID 规范中进行了描述,但在实践中并不常见,事实上大多数 OpenID 库甚至不支持它们。 DotNetOpenAuth 可以。These are all concepts directly from the OpenID 2.0 spec, so you can refer there for the complete answer. And by the way there is a .chm doc file that is included with DotNetOpenAuth that documents these members as well.
But here is what you're asking for:
IsDelegatedIdentifier
A value indicating whether the user is hosting his own OpenID identifier that then delegates to your Provider. Not usually something you need to do anything special for as DotNetOpenAuth takes care of everything for you. But in case you had a policy of disallowing delegation, this would provide the way.IsDirectedIdentity
A value indicating whether the user/RP already knows what claimed identifier they are expecting to get back. Iffalse
, they already know and you (the Provider) need to simply verify that the logged in user controls that identifier; iftrue
you need as the Provider to determine which user is logged in, and set the ClaimedIdentifier property to a value appropriate for that user.Immediate
A value indicating whether you must make a decision immediately about approving or rejecting an RP request. Iftrue
you are not allowed to interact with the user, you may not display UI, you may only redirect back to the RP with your decision. Iffalse
you may ask the user to log in, ask them to confirm, etc. When in immediate mode, if you can't be sure who the user is or whether the user trusts the RP, you should always return a deny response.IAnonymousRequest
comes in instead ofIAuthenticationRequest
when the RP doesn't want a claimed identifier at all, but instead just want responses to OpenID request extensions that are included. In other words, they don't want to know who the user is, they just want to know something about them. These kinds of requests are described in the OpenID spec but are uncommon in practice, in fact most OpenID libraries don't even support them. DotNetOpenAuth does.