0

我正在编写一个自定义 Open Id 客户端,如下所示

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);
}

}`

如代码所示,我尝试使用http://localhost:39167/的 OpenIdProvider 是由 DotNetOAuth 示例开发的,即 OpenIdWebRingSsoProvider 和 OpenIdWebRingSsoRelyingParty,并在 RP webconfig 中定义为

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

我在我的网站上注册 CustomOpenIdClient 为

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

现在,当我尝试进行身份验证时,我得到No OpenId End Point found

OAuthWebSecurity.RequestAuthentication(Provider, ReturnUrl)

本地主机已在 RP 的 webconfig 中的白名单中定义。请让我知道我在这里缺少什么导致此 No OpenId End point 错误?

谢谢,
某人

4

1 回答 1

0

我能够使用

  <system.net>
        <defaultProxy>
            <proxy
              usesystemdefault="true"
              proxyaddress="http://webproxy....net:8080"
              bypassonlocal="true"
      />
        </defaultProxy>
    </system.net>
于 2013-09-25T08:16:59.013 回答