diff --git a/app/controllers/shipit/github_authentication_controller.rb b/app/controllers/shipit/github_authentication_controller.rb index 0d5345c95..af2f9c2e6 100644 --- a/app/controllers/shipit/github_authentication_controller.rb +++ b/app/controllers/shipit/github_authentication_controller.rb @@ -12,6 +12,11 @@ def callback session[:user_id] = sign_in_github(auth) + # We need to set this so that the /events and /sidekiq endpoint + # which leverage `UserRequiredMiddleware` will recognize the user + # is authenticated. + session[:authenticated] = true + redirect_to(return_url) end diff --git a/test/controllers/github_authentication_controller_test.rb b/test/controllers/github_authentication_controller_test.rb index f1e89a638..4b3ff3271 100644 --- a/test/controllers/github_authentication_controller_test.rb +++ b/test/controllers/github_authentication_controller_test.rb @@ -29,6 +29,7 @@ class GithubAuthenticationControllerTest < ActionController::TestCase user = User.find_by(login: 'shipit-user') assert_equal 's3cr3t', user.github_access_token assert_equal 44, user.github_id + assert session[:authenticated], "Expected session[:authenticated] to be true" end end end