using redis as backend store

This commit is contained in:
xdite 2013-02-13 16:48:44 +08:00
parent a7908e07d1
commit 67cc766f0c
3 changed files with 8 additions and 2 deletions

View file

@ -28,6 +28,7 @@ gem 'mustache'
gem 'nokogiri' gem 'nokogiri'
gem "omniauth" gem "omniauth"
gem "omniauth-openid" gem "omniauth-openid"
gem "openid-redis-store"
gem "omniauth-facebook" gem "omniauth-facebook"
gem "omniauth-twitter" gem "omniauth-twitter"
gem 'oj' gem 'oj'

View file

@ -283,6 +283,9 @@ GEM
omniauth-twitter (0.0.14) omniauth-twitter (0.0.14)
multi_json (~> 1.3) multi_json (~> 1.3)
omniauth-oauth (~> 1.0) omniauth-oauth (~> 1.0)
openid-redis-store (0.0.2)
redis
ruby-openid
pbkdf2 (0.1.0) pbkdf2 (0.1.0)
pg (0.14.1) pg (0.14.1)
polyglot (0.3.3) polyglot (0.3.3)
@ -477,6 +480,7 @@ DEPENDENCIES
omniauth-facebook omniauth-facebook
omniauth-openid omniauth-openid
omniauth-twitter omniauth-twitter
openid-redis-store
pbkdf2 pbkdf2
pg pg
pry-rails pry-rails

View file

@ -1,5 +1,6 @@
require 'openid/store/filesystem' require 'openid/store/filesystem'
require 'openssl' require 'openssl'
require 'openid_redis_store'
module OpenSSL module OpenSSL
module SSL module SSL
remove_const :VERIFY_PEER remove_const :VERIFY_PEER
@ -9,8 +10,8 @@ end
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
Rails.application.config.middleware.use OmniAuth::Builder do Rails.application.config.middleware.use OmniAuth::Builder do
provider :open_id, :store => OpenID::Store::Filesystem.new('/tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id', :require => 'omniauth-openid' provider :open_id, :store => OpenID::Store::Redis.new($redis), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id', :require => 'omniauth-openid'
provider :open_id, :store => OpenID::Store::Filesystem.new('/tmp'), :name => 'yahoo', :identifier => 'https://me.yahoo.com', :require => 'omniauth-openid' provider :open_id, :store => OpenID::Store::Redis.new($redis), :name => 'yahoo', :identifier => 'https://me.yahoo.com', :require => 'omniauth-openid'
provider :facebook, SiteSetting.facebook_app_id, SiteSetting.facebook_app_secret, :scope => "email" provider :facebook, SiteSetting.facebook_app_id, SiteSetting.facebook_app_secret, :scope => "email"
provider :twitter, SiteSetting.twitter_consumer_key , SiteSetting.twitter_consumer_secret provider :twitter, SiteSetting.twitter_consumer_key , SiteSetting.twitter_consumer_secret
end end