OpenID

I think I’ve been really lucky lately. In my new job I’m getting to work with many interesting things and OpenID is just one of them.

We are investing high in Ruby on Rails and we have now a few internal applications in development stages. Our manager wanted the ability to let people log in to our rails applications(for now) using their OpenID accounts.

It was a funny task, as I knew very little about OpenID. The idea actually is really good. Instead of creating a new user account on each new service/site you’d like to subscribe to, you create a single user account in a OpenID provider - like MyOpenID - and use this identity to authenticate yourself in the services/sites that support this protocol.

What do we earn from that? Well, in my opinion, we can get a couple of benefits:

- You don’t need to memorize 723 logins and 723 passwords (if you really care about creating different passwords for all of your user accounts)

- You don’t authenticate yourself to the service you’re attempting to use. This service actually asks to your provider if your identity is valid, and you authenticate yourself there. Nowhere else.

I strongly recommend you visit the OpenID to understand more about it.

But, back to the problem, we needed to put it working in a rails app. And that’s when I found the ruby-openid library, provided by OpenID Enabled.

It is a complete library, really well documented that provides an abstraction layer both for consumer and server applications.

My first step was to develop the consumer. That’s what you need if you are going to provide your users with OpenID authentication in your web site. The ruby-openid library comes with several samples that really helped me out here. They were developed using Ruby On Rails and are a really good start point.

After this step, I was asked to evaluate the possibility of being a OpenID provider. At first I thought it would be a really complicated task, but again this ruby library had a great example of a simple provider. The drawback is that the samples were developed in an older version of Rails ( < 2.x ) . So I had to freeze the Rails version to 1.2.5 so I could run the provider sample code.

I am now working on porting this code to Rails 2.x, into one of our applications and it’s been flowing well so far. Just wanted to share this library for those of you trying something similar. It is really worth a look.

Comments