2013-02-12 14:51:44 +08:00
|
|
|
require 'openssl'
|
2013-02-13 16:48:44 +08:00
|
|
|
require 'openid_redis_store'
|
2013-02-12 14:51:44 +08:00
|
|
|
|
2013-02-15 03:11:13 +08:00
|
|
|
# if you need to test this and are having ssl issues see:
|
2013-02-14 06:12:20 +08:00
|
|
|
# http://stackoverflow.com/questions/6756460/openssl-error-using-omniauth-specified-ssl-path-but-didnt-work
|
2013-02-12 14:51:44 +08:00
|
|
|
|
|
|
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
2013-02-14 06:12:20 +08:00
|
|
|
|
2013-02-15 03:11:13 +08:00
|
|
|
provider :open_id,
|
2013-03-25 08:21:18 +08:00
|
|
|
:store => OpenID::Store::Redis.new($redis),
|
|
|
|
:name => 'google',
|
|
|
|
:identifier => 'https://www.google.com/accounts/o8/id',
|
|
|
|
:require => 'omniauth-openid'
|
2013-02-14 06:12:20 +08:00
|
|
|
|
2013-02-15 03:11:13 +08:00
|
|
|
provider :open_id,
|
2013-03-25 08:21:18 +08:00
|
|
|
:store => OpenID::Store::Redis.new($redis),
|
|
|
|
:name => 'yahoo',
|
|
|
|
:identifier => 'https://me.yahoo.com',
|
|
|
|
:require => 'omniauth-openid'
|
2013-02-14 06:12:20 +08:00
|
|
|
|
2013-03-25 08:21:18 +08:00
|
|
|
# lambda is required for proper multisite support,
|
|
|
|
# without it subdomains will not function correctly
|
2013-02-15 03:11:13 +08:00
|
|
|
provider :facebook,
|
2013-03-25 08:21:18 +08:00
|
|
|
: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-14 06:12:20 +08:00
|
|
|
|
2013-02-15 03:11:13 +08:00
|
|
|
provider :twitter,
|
2013-03-25 08:21:18 +08:00
|
|
|
: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-14 06:12:20 +08:00
|
|
|
|
2013-02-26 12:28:32 +08:00
|
|
|
provider :github,
|
2013-03-25 08:21:18 +08:00
|
|
|
:setup => lambda { |env|
|
|
|
|
strategy = env['omniauth.strategy']
|
|
|
|
strategy.options[:client_id] = SiteSetting.github_client_id
|
|
|
|
strategy.options[:client_secret] = SiteSetting.github_client_secret
|
|
|
|
}
|
2013-02-26 12:28:32 +08:00
|
|
|
|
2013-02-26 08:10:16 +08:00
|
|
|
provider :browser_id,
|
2013-03-25 08:21:18 +08:00
|
|
|
:name => 'persona'
|
2013-02-26 08:10:16 +08:00
|
|
|
|
2013-05-24 04:40:50 +08:00
|
|
|
provider :cas,
|
|
|
|
:host => SiteSetting.cas_hostname
|
|
|
|
|
2013-02-14 06:12:20 +08:00
|
|
|
end
|