Commit 9f1e9f11f1e66d0b6f22dba2870a2372c091b3bb
Exists in
master
and in
4 other branches
Merge pull request #2346 from sodabrew/omniauth_configs
Allow the OmniAuth provider args parameter to be passed through
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
config/gitlab.yml.example
@@ -72,6 +72,8 @@ omniauth: | @@ -72,6 +72,8 @@ omniauth: | ||
72 | # Uncomment the lines and fill in the data of the auth provider you want to use | 72 | # Uncomment the lines and fill in the data of the auth provider you want to use |
73 | # If your favorite auth provider is not listed you can user others: | 73 | # If your favorite auth provider is not listed you can user others: |
74 | # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers | 74 | # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers |
75 | + # The 'app_id' and 'app_secret' parameters are always passed as the first two | ||
76 | + # arguments, followed by optional 'args' which can be either a hash or an array. | ||
75 | providers: | 77 | providers: |
76 | # - { name: 'google_oauth2', app_id: 'YOUR APP ID', | 78 | # - { name: 'google_oauth2', app_id: 'YOUR APP ID', |
77 | # app_secret: 'YOUR APP SECRET', | 79 | # 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 |