diff options
author | Stan Hu <stanhu@gmail.com> | 2019-06-07 01:57:29 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-06-07 02:23:23 +0300 |
commit | a30d8e4a49644af7b082892c677d5d3365309afe (patch) | |
tree | ff85af1d58e57f1615f7d40202e618fe7e98c6da /lib/gitlab/omniauth_initializer.rb | |
parent | 40a9d05464960bfdef2612e2b6e4c5c2752d4663 (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 'lib/gitlab/omniauth_initializer.rb')
-rw-r--r-- | lib/gitlab/omniauth_initializer.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab/omniauth_initializer.rb b/lib/gitlab/omniauth_initializer.rb index 2a2083ebae0..83204fa5d18 100644 --- a/lib/gitlab/omniauth_initializer.rb +++ b/lib/gitlab/omniauth_initializer.rb @@ -63,6 +63,12 @@ module Gitlab { remote_sign_out_handler: authentiq_signout_handler } when 'shibboleth' { fail_with_empty_uid: true } + when 'openid_connect' + # If a name argument is omitted, OmniAuth will expect that the + # matching route is /auth/users/openidconnect instead of + # /auth/users/openid_connect because of + # https://gitlab.com/gitlab-org/gitlab-ce/issues/62208#note_178780341. + { name: 'openid_connect' } else {} end |