Skip to content

Commit da59625

Browse files
m0arktvdijen
authored andcommitted
Update getLogoutURL to accept nullable relayState parameter to fix iframe logout scenarios where no relayState is available (#37)
1 parent b8ffc67 commit da59625

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/IdP/ADFS.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,16 +645,20 @@ public static function receiveLogoutMessage(IdP $idp): void
645645
* accepts an association array, and returns a URL that can be accessed to terminate the association
646646
*
647647
* @param \SimpleSAML\IdP $idp
648-
* @param array $association
649-
* @param string $relayState
648+
* @param array<mixed> $association
649+
* @param string|null $relayState
650650
* @return string
651651
*/
652-
public static function getLogoutURL(IdP $idp, array $association, string $relayState): string
652+
public static function getLogoutURL(IdP $idp, array $association, ?string $relayState = null): string
653653
{
654654
$metadata = MetaDataStorageHandler::getMetadataHandler();
655655
$spMetadata = $metadata->getMetaDataConfig($association['adfs:entityID'], 'adfs-sp-remote');
656+
$params = ['assocId' => urlencode($association['id'])];
657+
if ($relayState !== null) {
658+
$params['relayState'] = urlencode($relayState);
659+
}
656660
$returnTo = Module::getModuleURL(
657-
'adfs/idp/prp.php?assocId=' . urlencode($association["id"]) . '&relayState=' . urlencode($relayState),
661+
'adfs/idp/prp.php', $params
658662
);
659663
return $spMetadata->getValue('prp') . '?wa=wsignoutcleanup1.0&wreply=' . urlencode($returnTo);
660664
}

0 commit comments

Comments
 (0)