asp.net-mvc – DotNetOpenAuth:消息签名不正确
发布时间:2020-05-23 09:42:59 所属栏目:asp.Net 来源:互联网
导读:尝试使用MyOpenID和Yahoo进行身份验证时,我会收到一条“消息签名不正确”异常. 我几乎使用了DotNetOpenAuth 3.4.2附带的ASP.NET MVC示例代码 public ActionResult Authenticate(string openid){ var openIdRelyingParty = new OpenIdRelyingParty(); v
|
尝试使用MyOpenID和Yahoo进行身份验证时,我会收到一条“消息签名不正确”异常. 我几乎使用了DotNetOpenAuth 3.4.2附带的ASP.NET MVC示例代码 public ActionResult Authenticate(string openid)
{
var openIdRelyingParty = new OpenIdRelyingParty();
var authenticationResponse = openIdRelyingParty.GetResponse();
if (authenticationResponse == null)
{
// Stage 2: User submitting identifier
Identifier identifier;
if (Identifier.TryParse(openid,out identifier))
{
var realm = new Realm(Request.Url.Root() + "openid");
var authenticationRequest = openIdRelyingParty.CreateRequest(openid,realm);
authenticationRequest.RedirectToProvider();
}
else
{
return RedirectToAction("login","home");
}
}
else
{
// Stage 3: OpenID provider sending assertion response
switch (authenticationResponse.Status)
{
case AuthenticationStatus.Authenticated:
{
// TODO
}
case AuthenticationStatus.Failed:
{
throw authenticationResponse.Exception;
}
}
}
return new EmptyResult();
}
与Google,AOL等人合作.但是,雅虎和MyOpenID属于AuthenticationStatus.Failed案例,但出现以下异常: DotNetOpenAuth.Messaging.Bindings.InvalidSignatureException: Message signature was incorrect. at DotNetOpenAuth.OpenId.ChannelElements.SigningBindingElement.ProcessIncomingMessage(IProtocolMessage message) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdChannelElementsSigningBindingElement.cs:line 139 at DotNetOpenAuth.Messaging.Channel.ProcessIncomingMessage(IProtocolMessage message) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthMessagingChannel.cs:line 992 at DotNetOpenAuth.OpenId.ChannelElements.OpenIdChannel.ProcessIncomingMessage(IProtocolMessage message) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdChannelElementsOpenIdChannel.cs:line 172 at DotNetOpenAuth.Messaging.Channel.ReadFromRequest(HttpRequestInfo httpRequest) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthMessagingChannel.cs:line 386 at DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty.GetResponse(HttpRequestInfo httpRequestInfo) in c:UsersandarnogitdotnetopenidsrcDotNetOpenAuthOpenIdRelyingPartyOpenIdRelyingParty.cs:line 540 显示其他人有同样的问题:http://trac.dotnetopenauth.net:8000/ticket/172 有没有人有解决方法? 解决方法事实证明,这是在Web场环境中使用DotNetOpenAuth的问题.当您创建OpenIdRelyingParty时,请确保在构造函数中传递null. 这将使您的网站进入OpenID无状态或“哑”模式.用户登录稍慢一些(如果您注意到),但您避免不必编写一个IRelyingPartyApplicationStore来允许DotNetOpenAuth在您的农场中工作; var openIdRelyingParty = new OpenIdRelyingParty(null); (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 如果表单字段为空,如何将NULL插入数据库
- asp.net – ‘WebForm_DoPostBackWithOptions’在IE11预览中
- asp.net-core – 使用.NET Core时需要AssemblyInfo吗?
- asp.net – web.config中的元素和项目文件之间有什么不同
- asp.net – 如果在MVC 3中没有认证,如何轻松重定向?
- Asp.Net Identity – 在运行时设置CookieDomain
- 发布ASP.NET应用程序时,是否应该将构建类型更改为Visual St
- 依赖于文件的.net核心asp.net单元测试 – appsettings.json
- asp.net-mvc – 如何避免打开重定向漏洞并成功登录安全地重
- asp.net – 渗透测试人员说.ASPXAUTH cookie是不安全的并且
推荐文章
站长推荐
- asp.net – 使用Cookie进行Web会话状态 – 有哪些
- asp.net-mvc-3 – 如何将MVC3中的HTML和C#代码与
- 如何不缓存ASP.NET用户控件?
- asp.net-mvc-3 – 在控制器操作完成后使用Javasc
- asp.net-mvc – 如何避免打开重定向漏洞并成功登
- asp.net-mvc – 如何告诉Ninject绑定到它没有引用
- asp.net – 有一个ClientScriptManager.Register
- ASP.Net MVC如何将数据从视图传递到控制器
- asp.net – 多个域的集成Windows身份验证
- asp.net-mvc – 在asp.net mvc中,单个项目与多个
热点阅读
