FIX: Correct server error for starting SSO login, and add spec (#12010)

Followup to 821bb1e8cb
This commit is contained in:
David Taylor 2021-02-08 10:59:43 +00:00 committed by GitHub
parent 6d31ead050
commit 7e6cb1ff2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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"