DEV: improves error message when sso param is not passed (#8549)
SingleSignOnProvider is expecting a sso param later in the chain. If sso param is not found it will cause a 500 with the following exception: `NoMethodError (undefined method `unpack1' for nil:NilClass)` as `set_return_sso_url` is attempting to decode it: https://github.com/discourse/discourse/blob/master/lib/single_sign_on_provider.rb#L19
This commit is contained in:
parent
1002bf62e5
commit
aa73df768a
|
@ -41,10 +41,12 @@ class SessionController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def sso_provider(payload = nil)
|
def sso_provider(payload = nil)
|
||||||
payload ||= request.query_string
|
|
||||||
|
|
||||||
if SiteSetting.enable_sso_provider
|
if SiteSetting.enable_sso_provider
|
||||||
begin
|
begin
|
||||||
|
if !payload
|
||||||
|
params.require(:sso)
|
||||||
|
payload = request.query_string
|
||||||
|
end
|
||||||
sso = SingleSignOnProvider.parse(payload)
|
sso = SingleSignOnProvider.parse(payload)
|
||||||
rescue SingleSignOnProvider::BlankSecret
|
rescue SingleSignOnProvider::BlankSecret
|
||||||
render plain: I18n.t("sso.missing_secret"), status: 400
|
render plain: I18n.t("sso.missing_secret"), status: 400
|
||||||
|
|
Loading…
Reference in New Issue