views:

1128

answers:

7

I'm developing a website (in Django) that uses OpenID to authenticate users. As I'm currently only running on my local machine I can't authenticate using one of the OpenID providers on the web. So I figure I need to run a local OpenID server that simply lets me type in a username and then passes that back to my main app.

Does such an OpenID dev server exist? Is this the best way to go about it?

+3  A: 

I'm also looking into this. I too am working on a Django project that might utilize Open Id. For references, check out:

Hopefully someone here has tackled this issue.

jobscry
+3  A: 

I'm using phpMyID to authenticate at StackOverflow right now. Generates a standard HTTP auth realm and works perfectly. It should be exactly what you need.

Andrew
+1  A: 

Why not run an OpenID provider from your local machine?

If you are a .Net developer there is an OpenID provider library for .Net at Google Code. This uses the standard .Net profile provider mechanism and wraps it with an OpenID layer. We are using it to add OpenID to our custom authentication engine.

If you are working in another language/platform there are a number of OpenID implementation avalaiable from the OpenID community site here.

Al
+3  A: 

You could probably use the django OpenID library to write a provider to test against. Have one that always authenticates and one that always fails.

Aaron Maenpaa
That looks like it'll be the easiest way to do it as I'm already running Django. I was just hoping for a simple command line app that took no configuration.
d4nt
+7  A: 

I have no problems testing with myopenid.com. I thought there would be a problem testing on my local machine but it just worked. (I'm using ASP.NET with DotNetOpenId library).

The 'realm' and return url must contain the port number like 'http://localhost:93359'.

I assume it works OK because the provider does a client side redirect.

tpower
I had a problem today when my internet connection was down. I couldn't log into the application I was developing. I Guess this is one reason for having a local openId server.
tpower
+1  A: 

You shouldn't be having trouble developing against your own machine. What error are you getting?

An OpenID provider will ask you to give your site (in this case http://localhost:8000 or similar) access to your identity. If you click ok then it will redirect you that url. I've never had problems with livejournal and I expect that myopenid.com will work too.

If you're having problems developing locally I suggest that the problem you're having is unrelated to the url being localhost, but something else. Without an error message or problem description it's impossible to say more.

Edit: It turns out that Yahoo do things differently to other OpenID providers that I've come across and disallow redirections to ip address, sites without a correct tld in their domain name and those that run on ports other than 80 or 443. See here for a post from a Yahoo developer on this subject. This post offers a work around, but I would suggest that for development myopenid.com would be far simpler than working around Yahoo, or running your own provider.

Andrew Wilkinson
Say I type in yahoo.com as my OpenID provider, I get directed to the yahoo page that "localhost" is trying to authenticate me and it doesn't like it. My understanding of OpenID is that the provider will contact my site and as my site is not on the web that cannot work.
d4nt
No, your site contacts the OpenID provider which then authenticates the user and redirects back to your site. I am not aware of any request from the provider to the client site. You really need to be clearer on what you mean by 'doesn't like it'. Have you tried another provider such as myopenid.com?
Andrew Wilkinson
http://openid.net/specs/openid-authentication-2_0.html#rp_discoveryThere is an optional component of OpenID 2.0 in which the provider will contact your site, and Yahoo does this. But it's not a requirement for all providers.
keturn
+13  A: 

The libraries at OpenID Enabled ship with examples that are sufficient to run a local test provider. Look in the examples/djopenid/ directory of the python-openid source distribution. Running that will give you an instance of this test provider.

keturn