DotnetOpenAuth : No OpenId End point found error for localhost

こ雲淡風輕ζ 提交于 2019-12-12 02:46:59

问题


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

}`

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>`

And I am registering the CustomOpenIdClient in my website as

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

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

OAuthWebSecurity.RequestAuthentication(Provider, ReturnUrl)

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 ?

Thanks,
SB


回答1:


I was able to solve it using

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


来源:https://stackoverflow.com/questions/18291086/dotnetopenauth-no-openid-end-point-found-error-for-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!