DotnetOpenAuth:找不到本地主机的OpenId端点错误 [英] DotnetOpenAuth : No OpenId End point found error for localhost

查看:118
本文介绍了DotnetOpenAuth:找不到本地主机的OpenId端点错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写如下的自定义Open Id客户端

I am writing a custom Open Id Client as below

public class CustomOpenIdClient : OpenIdClient
{
 public CustomOpenIdClient() : base("TestOpenId", "`http://localhost:39167/server.aspx`")

{

}

protected override Dictionary<string, string> GetExtraData(IAuthenticationResponse response)
{
    FetchResponse fetchResponse = response.GetExtension<FetchResponse>();

    if (fetchResponse != null)
    {
        var extraData = new Dictionary<string, string>();
        extraData.Add("email", fetchResponse.GetAttributeValue(WellKnownAttributes.Contact.Email));
        extraData.Add("fullname", fetchResponse.GetAttributeValue(WellKnownAttributes.Name.FullName));
        return extraData;
    }

    return null;
}

protected override void OnBeforeSendingAuthenticationRequest(IAuthenticationRequest request)
{
    var fetchRequest = new FetchRequest();
    fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
    fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.FullName);
    request.AddExtension(fetchRequest);
}

}`

如代码中所示,我要使用的OpenIdProvider是 http://localhost:39167/ ,它是由DotNetOAuth样本(即OpenIdWebRingSsoProvider和OpenIdWebRingSsoRelyingParty)开发的,并且在RP Web配置中定义为

As seen in the code, the OpenIdProvider I am trying to use is http://localhost:39167/ which is being developed by the DotNetOAuth Samples i.e. OpenIdWebRingSsoProvider and OpenIdWebRingSsoRelyingParty and is defined in the RP webconfig as

`<appSettings>
    <add key="SsoProviderOPIdentifier" value="http://localhost:39167/"/>
    <add key="SsoProviderOPEndpoint" value="http://localhost:39167/server.aspx"/>
  </appSettings>`

我正在将我的CustomOpenIdClient注册为

And I am registering the CustomOpenIdClient in my website as

OAuthWebSecurity.RegisterClient(new CustomOpenIdClient(), "TestOpenId", new Dictionary<string, object>());

现在,当我尝试进行身份验证时,会得到找不到OpenId端点

Now when I try to authenticate I get No OpenId End Point found

OAuthWebSecurity.RequestAuthentication(Provider, ReturnUrl)

Localhost已经在RP的webconfig的白名单中定义. 请让我知道我在这里缺少什么导致此No OpenId Endpoint错误?

Localhost is already defined in the whitelist in RP's webconfig. Please let me know what am I missing here which is causing this No OpenId End point error ?

谢谢,
SB

Thanks,
SB

推荐答案

我能够使用

  <system.net>
        <defaultProxy>
            <proxy
              usesystemdefault="true"
              proxyaddress="http://webproxy....net:8080"
              bypassonlocal="true"
      />
        </defaultProxy>
    </system.net>

这篇关于DotnetOpenAuth:找不到本地主机的OpenId端点错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆