1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
<?php
/**
* This is the page the user lands on when choosing "no" in the consent form.
*
* @package SimpleSAMLphp
*/
if (!array_key_exists('StateId', $_REQUEST)) {
throw new \SimpleSAML\Error\BadRequest(
'Missing required StateId query parameter.'
);
}
$id = $_REQUEST['StateId'];
$state = \SimpleSAML\Auth\State::loadState($id, 'consent:request');
$resumeFrom = \SimpleSAML\Module::getModuleURL(
'consent/getconsent.php',
['StateId' => $id]
);
$logoutLink = \SimpleSAML\Module::getModuleURL(
'consent/logout.php',
['StateId' => $id]
);
$aboutService = null;
if (!isset($state['consent:showNoConsentAboutService']) || $state['consent:showNoConsentAboutService']) {
if (isset($state['Destination']['url.about'])) {
$aboutService = $state['Destination']['url.about'];
}
}
$statsInfo = [];
if (isset($state['Destination']['entityid'])) {
$statsInfo['spEntityID'] = $state['Destination']['entityid'];
}
\SimpleSAML\Stats::log('consent:reject', $statsInfo);
if (array_key_exists('name', $state['Destination'])) {
$dstName = $state['Destination']['name'];
} elseif (array_key_exists('OrganizationDisplayName', $state['Destination'])) {
$dstName = $state['Destination']['OrganizationDisplayName'];
} else {
$dstName = $state['Destination']['entityid'];
}
$globalConfig = \SimpleSAML\Configuration::getInstance();
$t = new \SimpleSAML\XHTML\Template($globalConfig, 'consent:noconsent.php');
$translator = $t->getTranslator();
$t->data['dstMetadata'] = $state['Destination'];
$t->data['resumeFrom'] = $resumeFrom;
$t->data['aboutService'] = $aboutService;
$t->data['logoutLink'] = $logoutLink;
$dstName = htmlspecialchars(is_array($dstName) ? $translator->t($dstName) : $dstName);
$t->data['noconsent_text'] = $translator->t('{consent:consent:noconsent_text}', ['SPNAME' => $dstName]);
$t->data['noconsent_abort'] = $translator->t('{consent:consent:abort}', ['SPNAME' => $dstName]);
$t->show();
|