Skip to content
Snippets Groups Projects
Unverified Commit 59e1dd5f authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Create a PHP template for IFrameLogoutHandler

This was inline in the script, and later migrated to a twig template. This made us force the use of twig, or otherwise the template would not work for the old user interface. We shouldn't do that, and we should have a proper PHP template in place.
parent 014992c8
No related branches found
No related tags found
No related merge requests found
...@@ -99,32 +99,14 @@ class IFrameLogoutHandler implements LogoutHandlerInterface ...@@ -99,32 +99,14 @@ class IFrameLogoutHandler implements LogoutHandlerInterface
$this->idp->terminateAssociation($assocId); $this->idp->terminateAssociation($assocId);
$config = Configuration::getInstance(); $config = Configuration::getInstance();
$usenewui = $config->getBoolean('usenewui', false);
// Force the use of Twig for this method. Remove if-clause in 2.0 $t = new Template($config, 'IFrameLogoutHandler.tpl.php');
if ($usenewui === false) {
$config = Configuration::loadFromArray([
'usenewui' => true,
]);
}
$t = new Template($config, 'IFrameLogoutHandler.twig');
$t->data['assocId'] = var_export($assocId, true); $t->data['assocId'] = var_export($assocId, true);
$t->data['spId'] = sha1($assocId); $t->data['spId'] = sha1($assocId);
if (!is_null($error)) { if (!is_null($error)) {
$t->data['errorMsg'] = $error->getMessage(); $t->data['errorMsg'] = $error->getMessage();
} }
// Remove the if-clause in 2.0, leave the else-part $t->show();
if ($usenewui === false) {
$twig = $t->getTwig();
if (!isset($twig)) {
throw new \Exception('Even though we explicitly configure that we want Twig, the Template class does not give us Twig. This is a bug.');
}
$result = $twig->render('IFrameLogoutHandler.twig', $t->data);
echo $result;
} else {
$t->show();
}
} }
} }
<!DOCTYPE html>
<html>
<head>
<title>Logout response from <?= htmlspecialchars(var_export($this->data['assocId'])); ?></title>
<script>
<?php
if (array_key_exists('errorMsg', $this->data)) {
echo 'window.parent.logoutFailed("'.$this->data['spId'].'", "'.addslashes($this->data['errorMsg']).'");';
} else {
echo 'window.parent.logoutCompleted("'.$this->data['spId'].'");';
}
?>
</script>
</head>
<body></body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment