summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-03-22 08:58:23 +0000
committerDouwe Maan <douwe@gitlab.com>2018-03-22 08:58:23 +0000
commitd14b842820a9672a8a7bbd85c636e7d16ec58c3d (patch)
treef123d0f1483843a1ff06d92879d3bc17f4464e97 /config
parent5790caa7dc2fccf506a58da65f7d8aefaae3a18b (diff)
parent60b480fe814975b508f01bd1ae4f455f3ec454eb (diff)
downloadgitlab-ce-d14b842820a9672a8a7bbd85c636e7d16ec58c3d.tar.gz
Merge branch 'jej/omniauth-initializer-refactor' into 'master'
OmniauthInitializer created to allow testing/refactoring of code from devise.rb See merge request gitlab-org/gitlab-ce!17881
Diffstat (limited to 'config')
-rw-r--r--config/initializers/devise.rb46
1 files changed, 1 insertions, 45 deletions
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index f642e6d47e0..362b9cc9a88 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -219,49 +219,5 @@ Devise.setup do |config|
end
end
- Gitlab.config.omniauth.providers.each do |provider|
- provider_arguments = []
-
- %w[app_id app_secret].each do |argument|
- provider_arguments << provider[argument] if provider[argument]
- end
-
- case provider['args']
- when Array
- # An Array from the configuration will be expanded.
- provider_arguments.concat provider['args']
- when Hash
- # Add procs for handling SLO
- if provider['name'] == 'cas3'
- provider['args'][:on_single_sign_out] = lambda do |request|
- ticket = request.params[:session_index]
- raise "Service Ticket not found." unless Gitlab::Auth::OAuth::Session.valid?(:cas3, ticket)
-
- Gitlab::Auth::OAuth::Session.destroy(:cas3, ticket)
- true
- end
- end
-
- if provider['name'] == 'authentiq'
- provider['args'][:remote_sign_out_handler] = lambda do |request|
- authentiq_session = request.params['sid']
- if Gitlab::Auth::OAuth::Session.valid?(:authentiq, authentiq_session)
- Gitlab::Auth::OAuth::Session.destroy(:authentiq, authentiq_session)
- true
- else
- false
- end
- end
- end
-
- if provider['name'] == 'shibboleth'
- provider['args'][:fail_with_empty_uid] = true
- end
-
- # A Hash from the configuration will be passed as is.
- provider_arguments << provider['args'].symbolize_keys
- end
-
- config.omniauth provider['name'].to_sym, *provider_arguments
- end
+ Gitlab::OmniauthInitializer.new(config).execute(Gitlab.config.omniauth.providers)
end