1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 # This file is called omniauth_init.rb instead of omniauth.rb because
6 # older versions had site configuration in omniauth.rb.
8 # It must come after omniauth.rb in (lexical) load order.
10 if defined? CUSTOM_PROVIDER_URL
11 Rails.logger.warn "Copying omniauth from globals in legacy config file."
12 Rails.configuration.Login["ProviderAppID"] = APP_ID
13 Rails.configuration.Login["ProviderAppSecret"] = APP_SECRET
14 Rails.configuration.Services["SSO"]["ExternalURL"] = CUSTOM_PROVIDER_URL
16 Rails.application.config.middleware.use OmniAuth::Builder do
18 Rails.configuration.Login["ProviderAppID"],
19 Rails.configuration.Login["ProviderAppSecret"],
20 Rails.configuration.Services["SSO"]["ExternalURL"])
22 OmniAuth.config.on_failure = StaticController.action(:login_failure)