From 997add3af966a2a69dfd26d1125d7c016922c8c6 Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Thu, 25 Jul 2019 00:18:27 +0300 Subject: [PATCH] DEV: Add extension point to allow modifying SSO URL (#7937) This allows plugins to, for example, add extra query params to the SSO URL when discourse redirects to to the SSO website. --- app/controllers/session_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index b48ee8a8f14..1ca3f8a476e 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -39,7 +39,7 @@ class SessionController < ApplicationController if SiteSetting.verbose_sso_logging Rails.logger.warn("Verbose SSO log: Started SSO process\n\n#{sso.diagnostics}") end - redirect_to sso.to_url + redirect_to sso_url(sso) else render body: nil, status: 404 end @@ -525,4 +525,9 @@ class SessionController < ApplicationController @sso_error = text render status: status, layout: 'no_ember' end + + # extension to allow plugins to customize the SSO URL + def sso_url(sso) + sso.to_url + end end