Commit aec1a84042a789bc5a7926ec91b49c2b689e081d
1 parent
6a932d0a
Exists in
master
and in
4 other branches
Allow the OmniAuth provider args parameter to pass through as either an Array or a Hash.
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
config/gitlab.yml.example
| ... | ... | @@ -66,6 +66,8 @@ omniauth: |
| 66 | 66 | # Uncomment the lines and fill in the data of the auth provider you want to use |
| 67 | 67 | # If your favorite auth provider is not listed you can user others: |
| 68 | 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 | 71 | providers: |
| 70 | 72 | # - { name: 'google_oauth2', app_id: 'YOUR APP ID', |
| 71 | 73 | # app_secret: 'YOUR APP SECRET', | ... | ... |
config/initializers/devise.rb
| ... | ... | @@ -217,6 +217,15 @@ Devise.setup do |config| |
| 217 | 217 | end |
| 218 | 218 | |
| 219 | 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 | 230 | end |
| 222 | 231 | end | ... | ... |