gpt4 book ai didi

c# - 未找到 OpenID 终结点

转载 作者:太空狗 更新时间:2023-10-29 22:35:04 26 4
gpt4 key购买 nike

我正在尝试使用 DotNetOpenId 库在测试网站上添加 OpenID 支持。出于某种原因,它在 Firefox 上运行时不断给我以下错误。请记住,我使用的是 localhost,因为我正在我的本地机器上测试它。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.RelyingParty;

namespace TableSorterDemo
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var openid = new OpenIdRelyingParty();
if (openid.GetResponse() != null)
{
switch (openid.GetResponse().Status)
{
case AuthenticationStatus.Authenticated:
var fetch = openid.GetResponse().GetExtension(typeof(ClaimsResponse)) as ClaimsResponse;
var nick = fetch.Nickname;
var email = fetch.Email;

break;
}
}
}

protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e)
{
var openid = new OpenIdRelyingParty();
if(openid.GetResponse() != null)
{
switch(openid.GetResponse().Status)
{
case AuthenticationStatus.Authenticated:
var fetch = openid.GetResponse().GetExtension(typeof (ClaimsResponse)) as ClaimsResponse;
var nick = fetch.Nickname;
var email = fetch.Email;

break;
}
}


}

protected void OpenIdLogin1_LoggingIn(object sender, OpenIdEventArgs e)
{
var openid = new OpenIdRelyingParty();
var req = openid.CreateRequest(OpenIdLogin1.Text);
var fetch = new ClaimsRequest();
fetch.Email = DemandLevel.Require;
fetch.Nickname = DemandLevel.Require;
req.AddExtension(fetch);
req.RedirectToProvider();
return;
}


}
}

此外,如果我在 Chrome 中运行相同的页面,则会得到以下信息:

登录失败:此消息已被处理。这可能表明正在进行重放攻击。

最佳答案

重播攻击检测是您两次调用 GetResponse() 的结果。你不能那样做。相反,只需将对 GetResponse() 的一次调用的结果分配给一个局部变量,然后检查它是否为 null,否则就使用它。

关于“未找到 OpenID 端点”错误,您是针对本地主机 OpenID 还是针对由外部方(如 Yahoo)托管的 OpenID 进行测试?

关于c# - 未找到 OpenID 终结点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2520493/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com