SameShirtEveryDay.com

Personal blog of the one called Alex Gorbatchev, from Toronto, Canada.

open_id_authentication

Posted on June 6th, 2007 by Alex Gorbatchev. In Rails. No comments yet...

As always folks, all good ideas come to you right after your release the bad once.

After writing and making my user registration all pretty for Noobkit, I realized today, about 12 hours after release, that it would’ve been much easier and better if were to just use Open ID.

Having looked around for a decent acts_as_open_id_user_and_does_everything_else plugin, the only thing I found was this shameful attempt by none other than the DHH himself.

I don’t know if he was high when he submitted it because it’s just horrible. Never mind the fact that it doesn’t run at all and code has syntax errors. Methods that are called just once, strange object/result/message bubbling and integration with user models which are never mentioned anywhere except on the error pages. Worst of all, it actually extends ApplicationController. Do I really need Open ID authentication methods in every single controller? Where’s all the prettiness and tidiness?

Well, I brought my own bag of said “prettiness and tidiness”. The result is my own open_id_authentication plugin. I’ve cleaned up the code, made it a regular module to be included in a model and split up spaghetti dual purpose method into two simple methods. One to be called to start Open ID authentication process and the second one to process response from the Open ID server.

Next time, when I learn how to create generators in plugins I will add some nice model generation. For now, it’s completely decoupled from the user model.

Enjoy!

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet, be the first one!

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> , rel="nofollow" in use - no link dropping, no keywords or domains as names; do not spam, and do not advertise!

home
Subscribe to this blog Follow me on Twitter My bookmarks on Delicious My photography on Flickr