From bf34b4c5ddd0000d8d173a3738f8194b44ab63c1 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Thu, 28 Apr 2016 08:48:38 +0200 Subject: [PATCH 1/2] set SessionIndex in SLORequest --- .../LogoutRequest/SetSessionIndexAction.php | 34 +++++++++++++++++++ .../SingleLogout/SloRequestActionBuilder.php | 4 +++ 2 files changed, 38 insertions(+) create mode 100644 src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php diff --git a/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php b/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php new file mode 100644 index 0000000..213db67 --- /dev/null +++ b/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php @@ -0,0 +1,34 @@ + + * + * This source file is subject to the GPL-3 license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LightSaml\Logout\Action\Profile\Outbound\LogoutRequest; + +use LightSaml\Action\Profile\AbstractProfileAction; +use LightSaml\Context\Profile\Helper\MessageContextHelper; +use LightSaml\Context\Profile\ProfileContext; +use LightSaml\Model\Assertion\NameID; + +/** + * Sets SessionIndex of the outbounding AuthnRequest with values given in the LogoutContext SsoSessionState. + */ +class SetSessionIndexAction extends AbstractProfileAction +{ + /** + * @param ProfileContext $context + */ + protected function doExecute(ProfileContext $context) + { + $logoutRequest = MessageContextHelper::asLogoutRequest($context->getOutboundContext()); + $ssoSessionState = $context->getLogoutSsoSessionState(); + + $logoutRequest->setSessionIndex($ssoSessionState->getSessionIndex()); + } +} diff --git a/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php b/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php index a712550..825e9cc 100644 --- a/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php +++ b/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php @@ -19,6 +19,7 @@ use LightSaml\Logout\Action\Profile\Outbound\LogoutRequest\ResolveLogoutPartyAction; use LightSaml\Logout\Action\Profile\Outbound\LogoutRequest\SetNameIdAction; use LightSaml\Logout\Action\Profile\Outbound\LogoutRequest\SetNotOnOrAfterAction; +use LightSaml\Logout\Action\Profile\Outbound\LogoutRequest\SetSessionIndexAction; use LightSaml\Action\Profile\Outbound\Message\MessageIdAction; use LightSaml\Action\Profile\Outbound\Message\MessageIssueInstantAction; use LightSaml\Action\Profile\Outbound\Message\MessageVersionAction; @@ -69,6 +70,9 @@ protected function doInitialize() $proceedActionBuilder->add(new SetNameIdAction( $this->buildContainer->getSystemContainer()->getLogger() )); + $proceedActionBuilder->add(new SetSessionIndexAction( + $this->buildContainer->getSystemContainer()->getLogger() + )); $proceedActionBuilder->add(new SetNotOnOrAfterAction( $this->buildContainer->getSystemContainer()->getLogger(), $this->buildContainer->getSystemContainer()->getTimeProvider(), From 7eee5fbc54e526ef17f4037db61dcd9c9555a92a Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Sun, 1 May 2016 11:38:46 +0200 Subject: [PATCH 2/2] php-cs-fixer --- .../Outbound/LogoutRequest/ResolveLogoutPartyAction.php | 2 +- .../Profile/Outbound/LogoutRequest/SetSessionIndexAction.php | 1 - .../Action/Profile/SingleLogout/SloRequestActionBuilder.php | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/ResolveLogoutPartyAction.php b/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/ResolveLogoutPartyAction.php index 7476cec..cc4672e 100644 --- a/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/ResolveLogoutPartyAction.php +++ b/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/ResolveLogoutPartyAction.php @@ -93,6 +93,6 @@ private function findParty($entityId, array $entityDescriptorStores) } } - return null; + return; } } diff --git a/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php b/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php index 213db67..18f7824 100644 --- a/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php +++ b/src/LightSaml/Logout/Action/Profile/Outbound/LogoutRequest/SetSessionIndexAction.php @@ -14,7 +14,6 @@ use LightSaml\Action\Profile\AbstractProfileAction; use LightSaml\Context\Profile\Helper\MessageContextHelper; use LightSaml\Context\Profile\ProfileContext; -use LightSaml\Model\Assertion\NameID; /** * Sets SessionIndex of the outbounding AuthnRequest with values given in the LogoutContext SsoSessionState. diff --git a/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php b/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php index 825e9cc..c51ee83 100644 --- a/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php +++ b/src/LightSaml/Logout/Builder/Action/Profile/SingleLogout/SloRequestActionBuilder.php @@ -32,7 +32,6 @@ class SloRequestActionBuilder extends AbstractProfileActionBuilder { /** - * @return void */ protected function doInitialize() { @@ -72,7 +71,7 @@ protected function doInitialize() )); $proceedActionBuilder->add(new SetSessionIndexAction( $this->buildContainer->getSystemContainer()->getLogger() - )); + )); $proceedActionBuilder->add(new SetNotOnOrAfterAction( $this->buildContainer->getSystemContainer()->getLogger(), $this->buildContainer->getSystemContainer()->getTimeProvider(),