Skip to content

Commit

Permalink
OpenIdConnect: logout: transfer redirect URL via 'state'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbunkus committed Feb 19, 2024
1 parent 7d8833b commit 1e7ba19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function handleLogout(): void
try {
$oidc->signOut(
$id_token,
ILIAS_HTTP_PATH . '/logout.php',
ILIAS_HTTP_PATH . '/' . ilStartUpGUI::logoutUrl()
);
} catch (\Jumbojett\OpenIDConnectClientException $e) {
Expand Down
16 changes: 16 additions & 0 deletions logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@
* @package ilias-core
*/

/**
* @see https://www.php.net/manual/en/function.str-starts-with
*/
if (!function_exists('str_starts_with')) {
function str_starts_with(string $haystack, string $needle): bool
{
return strlen($needle) === 0 || strpos($haystack, $needle) === 0;
}
}

if(!empty($_GET['state']) && str_starts_with($_GET['state'], 'https://' . $_SERVER['SERVER_NAME'] . '/')) {
header('Location: ' . $_GET['state']);
exit;
}

require_once("Services/Init/classes/class.ilInitialisation.php");

ilInitialisation::initILIAS();

$ilCtrl->setCmd('doLogout');
Expand Down

0 comments on commit 1e7ba19

Please sign in to comment.