discourse/config/initializers/omniauth.rb

49 lines
1.7 KiB
Ruby
Raw Normal View History

require 'openssl'
2013-02-13 03:48:44 -05:00
require 'openid_redis_store'
# if you need to test this and are having ssl issues see:
2013-02-13 17:12:20 -05:00
# http://stackoverflow.com/questions/6756460/openssl-error-using-omniauth-specified-ssl-path-but-didnt-work
Rails.application.config.middleware.use OmniAuth::Builder do
2013-02-13 17:12:20 -05:00
provider :open_id,
:store => OpenID::Store::Redis.new($redis),
:name => 'google',
:identifier => 'https://www.google.com/accounts/o8/id',
:require => 'omniauth-openid'
2013-02-13 17:12:20 -05:00
provider :open_id,
:store => OpenID::Store::Redis.new($redis),
:name => 'yahoo',
:identifier => 'https://me.yahoo.com',
:require => 'omniauth-openid'
2013-02-13 17:12:20 -05:00
# lambda is required for proper multisite support,
# without it subdomains will not function correctly
provider :facebook,
: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"
2013-02-13 17:12:20 -05:00
provider :twitter,
:setup => lambda { |env|
strategy = env['omniauth.strategy']
strategy.options[:consumer_key] = SiteSetting.twitter_consumer_key
strategy.options[:consumer_secret] = SiteSetting.twitter_consumer_secret
}
2013-02-13 17:12:20 -05:00
provider :github,
: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'
2013-02-13 17:12:20 -05:00
end