我可以在本地机器中从依赖方在服务器上测试OpenID提供程序吗?-DotNetOpenAuth



我在Visual Studio中使用DNOA库创建了一个提供程序和一个依赖方,效果很好。然后,我将提供程序移到服务器上,并尝试从本地机器的依赖方对其进行测试。RP给出了"未找到OpenID终结点"的错误。

我想我在Web.config中缺少了一些东西。在WhitelistHost属性中,我添加了通配符"*",它应该使提供程序接受任何人的请求(用于测试目的)。还有什么我不知道的吗?我对这个话题还比较陌生。

Web.config-

<!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
   which is necessary for OpenID urls with unicode characters in the domain/host name. 
   It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
<uri>
    <idn enabled="All"/>
    <iriParsing enabled="true"/>
</uri>

<!-- this is an optional configuration section where aspects of DotNetOpenAuth can be customized -->
<dotNetOpenAuth>
    <openid>
        <provider>
            <security requireSsl="false" />
            <behaviors>
                <!-- Behaviors activate themselves automatically for individual matching requests. 
           The first one in this list to match an incoming request "owns" the request.  If no
           profile matches, the default behavior is assumed. -->
                <!--<add type="DotNetOpenAuth.OpenId.Provider.Behaviors.PpidGeneration, DotNetOpenAuth"/>-->
            </behaviors>
        </provider>
    </openid>
    <messaging>
        <untrustedWebRequest>
            <whitelistHosts>
                <!-- since this is a sample, and will often be used with localhost -->
                <add name="localhost"/>
                <add name="*"/>
            </whitelistHosts>
        </untrustedWebRequest>
    </messaging>
    <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
    <reporting enabled="true" />
</dotNetOpenAuth>
<appSettings>
    <add key="whitelistedRealms" value="http://localhost:39165/;http://othertrustedrealm/;http://localhost/;http://localhost:4856/"/>
    <!-- Set ImplicitAuth to true when using Windows auth, or false for FormsAuthentication -->
    <add key="ImplicitAuth" value="true"/>
</appSettings>
....

编辑:我不确定这是否重要,但服务器使用SSL。

我不确定你是否找到了这个问题的答案,但我也遇到了同样的问题。我能够修复这个问题,但不仅在提供者端,而且在依赖部分端都将localhost白名单。

尝试在白名单主机配置中显式显示-将服务器地址放在.中

除此之外,在RP和ID服务器上都打开日志记录。在RP上逐步完成流程。

此外,你的开发电脑和互联网之间有代理吗?如果是这样的话,你需要告诉你的RP代码如何通过它进行通信。

最新更新