summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-05-23 20:24:15 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-05-23 20:24:15 +0000
commit7b5cc7b47e1aa0221b9aac85049388192ade4ed4 (patch)
tree589b10c5ef569bc45ba6e3a272c0ba1260864738 /lib
parentd20df54e40e2190c7d70024bd8432f1f6c8c8ab0 (diff)
parentbf8f4c135a0d893defb6dd97e07b84184f5270a7 (diff)
downloadgitlab-ce-7b5cc7b47e1aa0221b9aac85049388192ade4ed4.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/omniauth_initializer.rb15
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'