MultiAuth
This engine provides basic signup/login functionalities for your Rails applications.
Install
$ sudo gem install okkez-multi_auth
or
$ sudo gem install multi_auth
Setup
RAILS_ROOT/config/environment.rb:
config.gem "multi_auth"
or
config.gem "okkez-multi_auth", :lib => "multi_auth"
$ ruby script/generate open_id_authentication_tables create_open_id_authentication_tables
Create migrations for open_id_authentication.
$ ruby script/generate multi_auth_migration create_multi_auth_tables
Create migrations for multi_auth.
$ rake db:migrate
You must have a model ‘User’. User model has any columns which you want to add.
Ex.
class User < ActiveRecord::Base
multi_auth
end
You can use MultiAuthHelper, see below.
Ex.
module ApplicationHelper
include MultiAuthHelper
end
You can use default style sheet and icons.
$ ruby script/generate multi_auth_public_assets
Upgrade
$ ruby script/generate multi_auth_migration upgrade_multi_auth_tables
Create migrations for multi_auth. Just add a table for NameCredential.
$ rake db:migrate
Settings
You can config in RAILS_ROOT/config/initializers/*.rb
Ex.
MultiAuth.setup do |s|
s.application_name = 'Your app name'
s.from_address = 'yourname@example.com'
s.user_model = 'YourUserModel'
s.session_times_out_in = 1.hour
# if false do not display in credentials index
s.credentials = { :open_id => true, :email => true, :name => true }
end
You can use OpenID::CustomFetcher to use OpenID provider which uses SSL.
Ex.
OpenID.fetcher = OpenID::CustomFetcher.new
OpenID.fetcher.ca_path = OpenSSL::X509::DEFAULT_CERT_PATH
Customize
If you want to use custom views, you can create RAILS_ROOT/app/view/activation_mailer,auth,credentials,signup/*.
TODO
see TODO.ja