diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index 257ea5d9851..0c190147747 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -29,7 +29,7 @@ class SessionController < ApplicationController if SiteSetting.verbose_discourse_connect_logging Rails.logger.warn("Verbose SSO log: Started SSO process\n\n#{sso.diagnostics}") end - redirect_to discourse_connect_url(sso) + redirect_to sso_url(sso) else render body: nil, status: 404 end diff --git a/spec/requests/session_controller_spec.rb b/spec/requests/session_controller_spec.rb index fd1061aee62..84420d9d011 100644 --- a/spec/requests/session_controller_spec.rb +++ b/spec/requests/session_controller_spec.rb @@ -503,6 +503,20 @@ RSpec.describe SessionController do end end + describe '#sso' do + before do + SiteSetting.discourse_connect_url = "http://example.com/discourse_sso" + SiteSetting.enable_discourse_connect = true + SiteSetting.discourse_connect_secret = "shjkfdhsfkjh" + end + + it "redirects correctly" do + get "/session/sso" + expect(response.status).to eq(302) + expect(response.location).to start_with(SiteSetting.discourse_connect_url) + end + end + describe '#sso_login' do before do @sso_url = "http://example.com/discourse_sso"