From 67cc766f0c86c4926d6b597bbd90d6e55e78e20f Mon Sep 17 00:00:00 2001 From: xdite Date: Wed, 13 Feb 2013 16:48:44 +0800 Subject: [PATCH] using redis as backend store --- Gemfile | 1 + Gemfile.lock | 4 ++++ config/initializers/omniauth.rb | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 2a23a5704db..b3056601065 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ gem 'mustache' gem 'nokogiri' gem "omniauth" gem "omniauth-openid" +gem "openid-redis-store" gem "omniauth-facebook" gem "omniauth-twitter" gem 'oj' diff --git a/Gemfile.lock b/Gemfile.lock index e545bfd986d..5aafa109dd8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -283,6 +283,9 @@ GEM omniauth-twitter (0.0.14) multi_json (~> 1.3) omniauth-oauth (~> 1.0) + openid-redis-store (0.0.2) + redis + ruby-openid pbkdf2 (0.1.0) pg (0.14.1) polyglot (0.3.3) @@ -477,6 +480,7 @@ DEPENDENCIES omniauth-facebook omniauth-openid omniauth-twitter + openid-redis-store pbkdf2 pg pry-rails diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index f0ad7681281..8ff8a09ece0 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,5 +1,6 @@ require 'openid/store/filesystem' require 'openssl' +require 'openid_redis_store' module OpenSSL module SSL remove_const :VERIFY_PEER @@ -9,8 +10,8 @@ end OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE 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::Filesystem.new('/tmp'), :name => 'yahoo', :identifier => 'https://me.yahoo.com', :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::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 :twitter, SiteSetting.twitter_consumer_key , SiteSetting.twitter_consumer_secret end \ No newline at end of file