开发者

No OpenID request was recognized in OpenIdProvider.GetRequest

I'm trying to im开发者_C百科plement an OpenId provider using DotNetOpenAuth. I'm using their 2 samples together, an MVC replying party and an MVC provider.

Provider hosted at: http://localhost:4864/OpenId/Provider

Relying hosting: http://localhost:54347/User/Login

I tried it with google (https://www.google.com/accounts/o8/id), and I got authenticated. When I tried http://localhost:4864/OpenId/Provider. The relying party said no openId endpoint was found. When I set a breakpoint on the provider, this code returns null:

IRequest request = OpenIdProvider.GetRequest()

So the comment for when request is null is this: No OpenID request was recognized. This may be a user that stumbled on the OP Endpoint.

So I guess my problem is at the provider end. What do I need to do to fix this?


in the dotnetopenauth sample, when the login screen asks for a provider and you want to use the sample mvc provider, the identifier to use in your case will be http://localhost:4864/

and not http://localhost:4864/OpenId/Provider


For me, I was using the sample MVC provider. Its HomeControllerhad the [Authorize] attribute. This meant the xrds request failed and so an exceptions 'Sequence contains no elements' and 'No OpenID endpoint found' were reported. Removing the [Authorize] attribute allows the xrds request to succeed and you can log in to a site being debugged in one instance of Visual Studio using OpenID from a site being debugged in another instance of Visual Studio.


For security reasons, DotNetOpenAuth RP defaults to disallowing OpenIDs that start with http://localhost/. For your testing purposes you can whitelist localhost so that it works for you:

<dotNetOpenAuth>
    <messaging>
        <untrustedWebRequest>
            <whitelistHosts>
                <!-- since this is a sample, and will often be used with localhost -->
                <add name="localhost" />
            </whitelistHosts>
        </untrustedWebRequest>
    </messaging>
</dotNetOpenAuth>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜