This project was originally forked from: joshsoftware/sso-devise-omniauth-provider
as part of a blog post: blog.joshsoftware.com/2010/12/16/multiple-applications-with-devise-omniauth-and-single-sign-on/
The key difference between the original and this fork, is the belief that a user should not have to input anything, or set a password when registering or logging in. With this in mind, a hash is created for the password, with a futher intention of providing an interface for linking more than one sso id with a single user account.
Objectives:
-
A single User Manager application (which will authenticate ALL users with different roles)
-
Different internal applications which talk to User Manager for authentication
-
User should be able to login/sign-up via Social Networks like Facebook and Google.
-
Single Sign On between all applications.
-
Registration and Authentication should be a one-click process.
This custom provider acts as an omniauth client (to connect to Twitter & Facebook) AND also acts as a omniauth provider (via auth_controller) to authenticate internal applications.
Clone this repository and do a bundle install. NOTE: We are using devise master HEAD because it has the latest omniauth integration code.
git clone git://github.com/joshsoftware/sso-devise-omniauth-provider.git bundle install rake db:create rake db:migrate
Create your Twitter App and Facebook App. Create the initializer file with the following omniauth configuration:( eg. I use config/initializers/omniauth.rb )
Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, 'facebook-appid', 'facebook-app-secret' end
That’s it! Your on your way:
rails server
In your browser, go for it:
http://localhost:3000
There is a demo available at sso-demo.herokuapp.com, and I will try to keep this deployment up-to-date with the mater branch
Please feel free to enhance this demo. For any doubts, please send an email to [email protected]