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
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-06-07 01:57:29 +0300
committerStan Hu <stanhu@gmail.com>2019-06-07 02:23:23 +0300
commita30d8e4a49644af7b082892c677d5d3365309afe (patch)
treeff85af1d58e57f1615f7d40202e618fe7e98c6da /spec/lib/gitlab/omniauth_initializer_spec.rb
parent40a9d05464960bfdef2612e2b6e4c5c2752d4663 (diff)
Make OpenID Connect work without requiring a name
If there is no name argument given, OmniAuth will try to guess the name by the class name. In https://github.com/omniauth/omniauth/blob/v1.9.0/lib/omniauth/strategy.rb#L139, `OmniAuth::Strategies::OpenIDConnect` gets translated to `openidconnect`. This leads to an immediate 404 error after clicking the login button because OmniAuth can't match the current route (/users/auth/openid_connect) against the expected one (/users/auth/openidconnect). Other providers, such as Google OAuth2, set this name as the default option within the OmniAuth Strategy. Until a fix is merged upstream, let's just set the parameter ourselves. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/62208
Diffstat (limited to 'spec/lib/gitlab/omniauth_initializer_spec.rb')
-rw-r--r--spec/lib/gitlab/omniauth_initializer_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/gitlab/omniauth_initializer_spec.rb b/spec/lib/gitlab/omniauth_initializer_spec.rb
index f9c0daf1ef1..32296caf819 100644
--- a/spec/lib/gitlab/omniauth_initializer_spec.rb
+++ b/spec/lib/gitlab/omniauth_initializer_spec.rb
@@ -83,5 +83,13 @@ describe Gitlab::OmniauthInitializer do
subject.execute([cas3_config])
end
+
+ it 'configures name for openid_connect' do
+ openid_connect_config = { 'name' => 'openid_connect', 'args' => {} }
+
+ expect(devise_config).to receive(:omniauth).with(:openid_connect, name: 'openid_connect')
+
+ subject.execute([openid_connect_config])
+ end
end
end