如何在C#中验证OpenId令牌?

问题描述 投票:1回答:1

我正在尝试使用此参数进行验证:

"openid.mode=check_authentication"<br>
+ "&openid.assoc_handle=" + txtAssocHandle.Text<br>
+ "&openid.response_nonce=" + HttpUtility.UrlEncode(txtNonce.Text)<br>
+ "&openid.op_endpoint=" + txtEndpoint.Text<br>
+ "&openid.sig=" + txtSignature.Text<br>
+ "&openid.signed=mode,identity,return_to";

它返回

is_valid:false
ns:http://specs.openid.net/auth/2.0

我在这里做错了什么?txt字段中填充了登录响应值

c# openid token
1个回答
0
投票

一方面,您的openid.signed参数必须是OP发送给您的RP的确切参数,而不是此不完整的3个参数的硬编码列表。您的所有参数也应该都经过URL编码,而不仅仅是您的随机数。

除了仅使用“哑模式”将其发送回OP之外,验证OpenID令牌还有很多其他功能。你想做什么?

您是否考虑过使用OpenID library?认真地讲,正确设置OpenID(意味着安全和可互操作)是一项艰巨的任务。比组装正确的查询字符串要大得多。 :)

© www.soinside.com 2019 - 2024. All rights reserved.