Gemified copy of ruby-openid ActiveRecord example.
Add this line to your application's Gemfile:
gem 'openid-activerecord-store'
And then execute:
$ bundle
Or install it yourself as:
$ gem install openid-activerecord-store
Add a migration:
class CreateOpenIdTables < ActiveRecord::Migration
def up
create_table "open_id_associations" do |t|
t.column "server_url", :string, :null => false
t.column "handle", :string, :null => false
t.column "secret", :binary, :null => false
t.column "issued", :integer, :null => false
t.column "lifetime", :integer, :null => false
t.column "assoc_type", :string, :null => false
end
create_table "open_id_nonces" do |t|
t.column :server_url, :string, :null => false
t.column :timestamp, :integer, :null => false
t.column :salt, :string, :null => false
end
end
def down
drop_table "open_id_associations"
drop_table "open_id_nonces"
end
end
Instantiate a new store:
store = OpenId::ActiveRecord::Store::Interface.new()
Here's an example configuration for Devise using omniauth, replacing the default FileStore:
require 'openid-activerecord-store'
config.omniauth(:open_id,
:store => OpenId::ActiveRecord::Store::Interface.new,
:name => 'intuit',
:identifier => 'https://openid.intuit.com/openid/xrds',
:require => 'omniauth-openid'
)
- Fork it ( https://github.com/TheNeatCompany/openid-activerecord-store/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request