Merge branch 'master' into 7167-keep-rsync-test-setup
[arvados.git] / services / api / config / initializers / omniauth_init.rb
1 # This file is called omniauth_init.rb instead of omniauth.rb because
2 # older versions had site configuration in omniauth.rb.
3 #
4 # It must come after omniauth.rb in (lexical) load order.
5
6 if defined? CUSTOM_PROVIDER_URL
7   Rails.logger.warn "Copying omniauth from globals in legacy config file."
8   Rails.configuration.sso_app_id = APP_ID
9   Rails.configuration.sso_app_secret = APP_SECRET
10   Rails.configuration.sso_provider_url = CUSTOM_PROVIDER_URL
11 else
12   Rails.application.config.middleware.use OmniAuth::Builder do
13     provider(:josh_id,
14              Rails.configuration.sso_app_id,
15              Rails.configuration.sso_app_secret,
16              Rails.configuration.sso_provider_url)
17   end
18   OmniAuth.config.on_failure = StaticController.action(:login_failure)
19 end