There are a couple ways you can go. If you're in a corporate
environment (as I was when I last did something like this), you may
want to integrate with an LDAP server of some kind (in my case it was
ActiveDirectory 2008). You'd then authenticate your users through
that LDAP server across all the sites you're running. You can even
set this kind of configuration up outside of a corporate environment -
having your own LDAP server (Open LDAP is a damn sight cheaper than
ActiveDirectory though!). Just make sure that if you do it this way,
you set up your LDAP server to be inaccessible from the outside world
as a security precaution.
Another possible route, similar to what Jaymin mentioned above, would
be using something like the Omniauth gem to allow users to
authenticate with their Google, Twitter, Facebook <whatever else>
accounts. Ryan Bates over at railscasts.com has several great
screencasts on omniauth, and I strongly encourage you to check them
If you really (and I mean reeeeeeeaaaaaaly) want to roll your own, you
could. You could set up a RESTful service that would communicate with
your three apps and allow them to authenticate a user or not.
I'd recommend against rolling your own simply because when you do
that, you run the risk of overlooking a few details that could open
your app up to various hacks (think weak encryption ciphers, broken
session handling, etc.), and the open source projects already out
there have had a lot more eyes look at their code to make sure it
doesn't have any gaping holes in it than anything you could roll on
your own without open sourcing it and lots of scrutiny. Besides, why
do the work when you can have somebody else do it?
There are a lot of different ways to go about it, but those are a few
options for you to take a look at! Good luck!