Commit aec1a84042a789bc5a7926ec91b49c2b689e081d

Authored by Aaron Stone
1 parent 6a932d0a

Allow the OmniAuth provider args parameter to pass through as either an Array or a Hash.

config/gitlab.yml.example
@@ -66,6 +66,8 @@ omniauth: @@ -66,6 +66,8 @@ omniauth:
66 # Uncomment the lines and fill in the data of the auth provider you want to use 66 # Uncomment the lines and fill in the data of the auth provider you want to use
67 # If your favorite auth provider is not listed you can user others: 67 # If your favorite auth provider is not listed you can user others:
68 # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers 68 # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers
  69 + # The 'app_id' and 'app_secret' parameters are always passed as the first two
  70 + # arguments, followed by optional 'args' which can be either a hash or an array.
69 providers: 71 providers:
70 # - { name: 'google_oauth2', app_id: 'YOUR APP ID', 72 # - { name: 'google_oauth2', app_id: 'YOUR APP ID',
71 # app_secret: 'YOUR APP SECRET', 73 # app_secret: 'YOUR APP SECRET',
config/initializers/devise.rb
@@ -217,6 +217,15 @@ Devise.setup do |config| @@ -217,6 +217,15 @@ Devise.setup do |config|
217 end 217 end
218 218
219 Gitlab.config.omniauth.providers.each do |provider| 219 Gitlab.config.omniauth.providers.each do |provider|
220 - config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'] 220 + case provider['args']
  221 + when Array
  222 + # An Array from the configuration will be expanded.
  223 + config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'], *provider['args']
  224 + when Hash
  225 + # A Hash from the configuration will be passed as is.
  226 + config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'], provider['args']
  227 + else
  228 + config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret']
  229 + end
221 end 230 end
222 end 231 end