Skip to content

Commit

Permalink
Fix raw template being returned by SingleLogoutResponse.php (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Aug 28, 2019
1 parent 675d8fe commit da787fb
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions lib/SimpleSAML/IdP/IFrameLogoutHandler.php
Expand Up @@ -89,16 +89,35 @@ public function onResponse($assocId, $relayState, \SimpleSAML\Error\Exception $e
{
assert(is_string($assocId));

$config = \SimpleSAML\Configuration::getInstance();
$this->idp->terminateAssociation($assocId);

$t = new \SimpleSAML\XHTML\Template($config, 'IFrameLogoutHandler.twig');
$config = \SimpleSAML\Configuration::getInstance();
$usenewui = $config->getBoolean('usenewui', false);

// Force the use of Twig for this method. Remove if-clause in 2.0
if ($usenewui === false) {
$config = Configuration::loadFromArray([
'usenewui' => true,
]);
}

$t = new Template($config, 'IFrameLogoutHandler.twig');
$t->data['assocId'] = var_export($assocId, true);
$t->data['spId'] = sha1($assocId);
if (!is_null($error)) {
$t->data['errorMsg'] = $error->getMessage();
}
$t->show();
exit(0);

// Remove the if-clause in 2.0, leave the else-part
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();
}
}
}

0 comments on commit da787fb

Please sign in to comment.