]> git.openstreetmap.org Git - rails.git/blob - config/initializers/omniauth.rb
Avoid relying on the order in which emails are sent
[rails.git] / config / initializers / omniauth.rb
1 OmniAuth.config.logger = Rails.logger
2 OmniAuth.config.failure_raise_out_environments = []
3
4 if defined?(MEMCACHE_SERVERS)
5   require "openid/store/memcache"
6
7   openid_store = OpenID::Store::Memcache.new(Dalli::Client.new(MEMCACHE_SERVERS, :namespace => "rails"))
8 else
9   require "openid/store/filesystem"
10
11   openid_store = OpenID::Store::Filesystem.new(Rails.root.join("tmp/openids"))
12 end
13
14 Rails.application.config.middleware.use OmniAuth::Builder do
15   provider :openid, :name => "openid", :store => openid_store
16 end
17
18 # Pending fix for: https://github.com/intridea/omniauth/pull/795
19 module OmniAuth
20   module Strategy
21     def mock_callback_call_with_origin
22       @env["omniauth.origin"] = session["omniauth.origin"]
23
24       mock_callback_call_without_origin
25     end
26
27     alias_method_chain :mock_callback_call, :origin
28   end
29 end