我正在编写一个自定义Open Id Client,如下所示
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 webconfig中定义为< / p>
`<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>());
现在,当我尝试进行身份验证时,我找不到OpenId End Point
OAuthWebSecurity.RequestAuthentication(Provider, ReturnUrl)
已在RP的webconfig中列入白名单中的Localhost。 请让我知道我在这里错过了什么导致这个No OpenId End point错误?
谢谢,
SB
答案 0 :(得分:0)
我能够使用
解决它 <system.net>
<defaultProxy>
<proxy
usesystemdefault="true"
proxyaddress="http://webproxy....net:8080"
bypassonlocal="true"
/>
</defaultProxy>
</system.net>