Page MenuHomePhabricator

gitlab-test: undefined method `user_cas_omniauth_authorize_path' with omniauth_auto_sign_in_with_provider
Closed, ResolvedPublic

Description

GitLab version: 13.8.4 (9fb9cbf50c3)

There's a decent chance this should be reported upstream; reporting here so I don't lose track of it.

In the omnibus configuration, when:

gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'cas'

is set, then /users/sign_in returns a 500 error and you get this exception in /var/log/gitlab/gitlab-rails/production.log:

Started GET "/users/sign_in" for [redacted] at 2021-02-16 21:40:16 +0000
Processing by SessionsController#new as HTML
Completed 500 Internal Server Error in 31ms (ActiveRecord: 1.1ms | Elasticsearch: 0.0ms | Allocations: 8168)

NoMethodError (undefined method `user_cas_omniauth_authorize_path' for #<ActionDispatch::Routing::RoutesProxy:0x00007f76e493e448>):

app/controllers/sessions_controller.rb:263:in `auto_sign_in_with_provider'
app/controllers/application_controller.rb:482:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:473:in `set_session_storage'
lib/gitlab/i18n.rb:73:in `with_locale'
lib/gitlab/i18n.rb:79:in `with_user_locale'
app/controllers/application_controller.rb:467:in `set_locale'
lib/gitlab/error_tracking.rb:52:in `with_context'
app/controllers/application_controller.rb:532:in `sentry_context'
app/controllers/application_controller.rb:460:in `block in set_current_context'
lib/gitlab/application_context.rb:56:in `block in use'
lib/gitlab/application_context.rb:56:in `use'
lib/gitlab/application_context.rb:22:in `with_context'
app/controllers/application_controller.rb:451:in `set_current_context'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/multipart.rb:172:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:23:in `call'
config/initializers/fix_local_cache_middleware.rb:9:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'

This feels like a bug, but also maybe there's some other value that's supposed to be set?

That method name comes from: devise-4.7.3/lib/devise/omniauth/url_helpers.rb

def omniauth_authorize_url(resource_or_scope, provider, *args)
  scope = Devise::Mapping.find_scope!(resource_or_scope)
  _devise_route_context.send("#{scope}_#{provider}_omniauth_authorize_url", *args)
end

Maybe auto sign-in isn't supported with the CAS integration?

Event Timeline

Should this be an upstream ticket? Or upstream's upstream (devise)?

gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'cas'

Looking in gitlab.rb i see that the gitlab_rails['omniauth_providers']['name'] == 'cas3' so wonder if the following works

gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'cas3'
thcipriani triaged this task as Medium priority.

@brennen to investigate if this was already solved or if it needs to be filed upstream and then moved to Release-Engineering-Team (Radar)

brennen moved this task from Backlog to Done or Declined on the User-brennen board.

Since we're currently using a value of cas3, I'm assuming this was just an error on my part.