Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-02-02 00:18:41 +0300
committerStan Hu <stanhu@gmail.com>2019-02-02 09:32:53 +0300
commit1f1882368710a0c093ec9c2f036e87d28d8c5b3b (patch)
tree14d1c018ae87d437525075f8bef271d2337d0168 /config
parentdd26a9addc5dd654e3c8eecb58216f1f4449cfc1 (diff)
Downcase aliased OAuth2 callback providers
Users may specify an OAuth2 callback with a custom name, such as AWSCognito, but Rails will reject this with the following message: ``` 'import/AWSCognito' is not a supported controller name. This can lead to potential routing problems. See http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use ``` To avoid these errors, we can just downcase all the provider names. Note that this will make it impossible to specify a duplicate name with different cases. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/57156
Diffstat (limited to 'config')
-rw-r--r--config/routes/import.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/config/routes/import.rb b/config/routes/import.rb
index 69df82611f2..da5c31d0062 100644
--- a/config/routes/import.rb
+++ b/config/routes/import.rb
@@ -1,7 +1,7 @@
# Alias import callbacks under the /users/auth endpoint so that
# the OAuth2 callback URL can be restricted under http://example.com/users/auth
# instead of http://example.com.
-Devise.omniauth_providers.each do |provider|
+Devise.omniauth_providers.map(&:downcase).each do |provider|
next if provider == 'ldapmain'
get "/users/auth/-/import/#{provider}/callback", to: "import/#{provider}#callback", as: "users_import_#{provider}_callback"