correct multisite functionality for omniauth

This commit is contained in:
Sam 2013-03-24 17:21:18 -07:00
parent deb603f41c
commit 988a712c77
2 changed files with 28 additions and 17 deletions

View file

@ -100,7 +100,7 @@ end
group :development do
gem 'better_errors'
gem 'binding_of_caller' # I tried adding this and got an occational crash
gem 'binding_of_caller'
gem 'librarian', '>= 0.0.25', require: false
gem 'pry-rails'
end

View file

@ -7,31 +7,42 @@ require 'openid_redis_store'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :open_id,
store: OpenID::Store::Redis.new($redis),
name: 'google',
identifier: 'https://www.google.com/accounts/o8/id',
require: 'omniauth-openid'
: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'
:store => OpenID::Store::Redis.new($redis),
:name => 'yahoo',
:identifier => 'https://me.yahoo.com',
:require => 'omniauth-openid'
# lambda is required for proper multisite support,
# without it subdomains will not function correctly
provider :facebook,
SiteSetting.facebook_app_id,
SiteSetting.facebook_app_secret,
scope: "email"
:setup => lambda { |env|
strategy = env['omniauth.strategy']
strategy.options[:client_id] = SiteSetting.facebook_app_id
strategy.options[:client_secret] = SiteSetting.facebook_app_secret
},
:scope => "email"
provider :twitter,
SiteSetting.twitter_consumer_key,
SiteSetting.twitter_consumer_secret
:setup => lambda { |env|
strategy = env['omniauth.strategy']
strategy.options[:consumer_key] = SiteSetting.twitter_consumer_key
strategy.options[:consumer_secret] = SiteSetting.twitter_consumer_secret
}
provider :github,
SiteSetting.github_client_id,
SiteSetting.github_client_secret
:setup => lambda { |env|
strategy = env['omniauth.strategy']
strategy.options[:client_id] = SiteSetting.github_client_id
strategy.options[:client_secret] = SiteSetting.github_client_secret
}
provider :browser_id,
name: 'persona'
:name => 'persona'
end