From 52600a413a546250e72e0f51a3e4cee9f8938da2 Mon Sep 17 00:00:00 2001 From: Florian Humer Date: Thu, 19 Dec 2019 12:33:45 +0100 Subject: [PATCH 1/2] add redirectTo parameter for logout URLs and redirect to RelayState after SLO is finished --- lib/Controller/SAMLController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index c0dffab32..757fb4be8 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -356,14 +356,21 @@ public function singleLogoutService() { $parameters = array(); $nameId = $this->session->get('user_saml.samlNameId'); $sessionIndex = $this->session->get('user_saml.samlSessionIndex'); - $targetUrl = $auth->logout(null, [], $nameId, $sessionIndex, $stay); + if (!empty($_GET['returnTo'])) { + $returnTo = $_GET['returnTo']; + } + $targetUrl = $auth->logout($returnTo, [], $nameId, $sessionIndex, $stay); } if(!empty($targetUrl) && !$auth->getLastErrorReason()){ $this->userSession->logout(); } } if(empty($targetUrl)){ - $targetUrl = $this->urlGenerator->getAbsoluteURL('/'); + if (!empty($_GET['RelayState'])) { + $targetUrl = $_GET['RelayState']; + } else { + $targetUrl = $this->urlGenerator->getAbsoluteURL('/'); + } } return new Http\RedirectResponse($targetUrl); From febc60709592ae6ffb572d502d6ef462050a4802 Mon Sep 17 00:00:00 2001 From: Florian Humer Date: Thu, 19 Dec 2019 12:36:36 +0100 Subject: [PATCH 2/2] add redirectTo parameter for logout URLs and redirect to RelayState after SLO is finished --- lib/Controller/SAMLController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index 757fb4be8..d67f56ea4 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -356,9 +356,9 @@ public function singleLogoutService() { $parameters = array(); $nameId = $this->session->get('user_saml.samlNameId'); $sessionIndex = $this->session->get('user_saml.samlSessionIndex'); - if (!empty($_GET['returnTo'])) { - $returnTo = $_GET['returnTo']; - } + if (!empty($_GET['returnTo'])) { + $returnTo = $_GET['returnTo']; + } $targetUrl = $auth->logout($returnTo, [], $nameId, $sessionIndex, $stay); } if(!empty($targetUrl) && !$auth->getLastErrorReason()){ @@ -366,11 +366,11 @@ public function singleLogoutService() { } } if(empty($targetUrl)){ - if (!empty($_GET['RelayState'])) { - $targetUrl = $_GET['RelayState']; - } else { - $targetUrl = $this->urlGenerator->getAbsoluteURL('/'); - } + if (!empty($_GET['RelayState'])) { + $targetUrl = $_GET['RelayState']; + } else { + $targetUrl = $this->urlGenerator->getAbsoluteURL('/'); + } } return new Http\RedirectResponse($targetUrl);