diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-05-23 23:24:15 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-06-03 16:08:45 +0300 |
commit | c416e630547d791ed6d15629d8af0c2e8d5b1125 (patch) | |
tree | 453e2d1386dd5d0f2bf5afed27976caffbdf3834 /lib | |
parent | f5610f598a14e6ffec56a9d67741c98637de7a96 (diff) |
Merge branch 'sh-fix-omniauth-generic-strategy' into 'master'
Fix OmniAuth OAuth2Generic strategy not loading
Closes #62216
See merge request gitlab-org/gitlab-ce!28680
(cherry picked from commit 7b5cc7b47e1aa0221b9aac85049388192ade4ed4)
bf8f4c13 Fix OmniAuth OAuth2Generic strategy not loading
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/omniauth_initializer.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/gitlab/omniauth_initializer.rb b/lib/gitlab/omniauth_initializer.rb index e0ac9eec1f2..2a2083ebae0 100644 --- a/lib/gitlab/omniauth_initializer.rb +++ b/lib/gitlab/omniauth_initializer.rb @@ -36,12 +36,25 @@ module Gitlab hash_arguments = provider['args'].merge(provider_defaults(provider)) # A Hash from the configuration will be passed as is. - provider_arguments << hash_arguments.symbolize_keys + provider_arguments << normalize_hash_arguments(hash_arguments) end provider_arguments end + def normalize_hash_arguments(args) + args.symbolize_keys! + + # Rails 5.1 deprecated the use of string names in the middleware + # (https://github.com/rails/rails/commit/83b767ce), so we need to + # pass in the actual class to Devise. + if args[:strategy_class].is_a?(String) + args[:strategy_class] = args[:strategy_class].constantize + end + + args + end + def provider_defaults(provider) case provider['name'] when 'cas3' |