summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2013-01-16 15:58:53 -0800
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2013-01-16 15:58:53 -0800
commit9f1e9f11f1e66d0b6f22dba2870a2372c091b3bb (patch)
treea49b28db365612d66da32d13b79f86be6ddc8a89
parent9cab79cbe640ba8ec842b2f5103871ae447ab1ab (diff)
parentaec1a84042a789bc5a7926ec91b49c2b689e081d (diff)
downloadgitlab-ce-9f1e9f11f1e66d0b6f22dba2870a2372c091b3bb.tar.gz
Merge pull request #2346 from sodabrew/omniauth_configs
Allow the OmniAuth provider args parameter to be passed through
-rw-r--r--config/gitlab.yml.example2
-rw-r--r--config/initializers/devise.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 4103550acdb..c1266daffc3 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -72,6 +72,8 @@ omniauth:
# Uncomment the lines and fill in the data of the auth provider you want to use
# If your favorite auth provider is not listed you can user others:
# see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers
+ # The 'app_id' and 'app_secret' parameters are always passed as the first two
+ # arguments, followed by optional 'args' which can be either a hash or an array.
providers:
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index ed3ab71862a..97946c54b40 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -217,6 +217,15 @@ Devise.setup do |config|
end
Gitlab.config.omniauth.providers.each do |provider|
- config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret']
+ case provider['args']
+ when Array
+ # An Array from the configuration will be expanded.
+ config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'], *provider['args']
+ when Hash
+ # A Hash from the configuration will be passed as is.
+ config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'], provider['args']
+ else
+ config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret']
+ end
end
end