From 7fd819a6e4cd8e98c9c876e46962b507c78701b5 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Wed, 6 Aug 2008 11:06:42 +0000 Subject: [PATCH] Consent: Add support for returning to consent page after answering "no". git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@800 44740490-163a-0410-bde0-09ae8108e29a --- dictionaries/consent.php | 3 +++ templates/default/consent.php | 7 ++++--- templates/default/noconsent.php | 8 ++++++++ www/noconsent.php | 3 +++ www/saml2/idp/SSOService.php | 6 +++++- www/shib13/idp/SSOService.php | 6 +++++- 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/dictionaries/consent.php b/dictionaries/consent.php index 8ae5c40bb..a034f30ca 100644 --- a/dictionaries/consent.php +++ b/dictionaries/consent.php @@ -189,6 +189,9 @@ $lang = array( 'hr' => 'Niste dali pristanak da se vaši podaci isporuče davatelju usluge.', 'hu' => 'Nem adta belegyezését, ahoz hogy adatait kiszlgálatassuk a szolgáltató felé.', ), + 'noconsent_return' => array ( + 'en' => 'Return to consent page', + ), ); diff --git a/templates/default/consent.php b/templates/default/consent.php index 566b85db5..47a869714 100644 --- a/templates/default/consent.php +++ b/templates/default/consent.php @@ -28,9 +28,10 @@ </form> <form style="display: inline; margin-left: .5em;" action="<?php echo htmlspecialchars($this->data['noconsent']); ?>" method="GET"> <?php -if(array_key_exists('sptype', $this->data) && array_key_exists('spentityid', $this->data)) { - echo('<input type="hidden" name="sptype" value="' . htmlspecialchars($this->data['sptype']) . '" />'); - echo('<input type="hidden" name="spentityid" value="' . htmlspecialchars($this->data['spentityid']) . '" />'); +if(array_key_exists('noconsent_data', $this->data)) { + foreach($this->data['noconsent_data'] as $name => $value) { + echo('<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />'); + } } ?> <input type="submit" id="nobutton" value="<?php echo htmlspecialchars($this->t('no')) ?>" /> diff --git a/templates/default/noconsent.php b/templates/default/noconsent.php index 40e4f5e16..0442ab7b5 100644 --- a/templates/default/noconsent.php +++ b/templates/default/noconsent.php @@ -10,4 +10,12 @@ <h2><?php echo($this->data['header']); ?></h2> <p><?php echo($this->t('{consent:noconsent_text}')); ?></p> +<?php + if($this->data['resumeFrom']) { + echo('<p><a href="' . htmlspecialchars($this->data['resumeFrom']) . '">'); + echo($this->t('{consent:noconsent_return}')); + echo('</a></p>'); + } +?> + <?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/www/noconsent.php b/www/noconsent.php index 6d6e0a8b5..adc28dcb5 100644 --- a/www/noconsent.php +++ b/www/noconsent.php @@ -14,6 +14,9 @@ $session = SimpleSAML_Session::getInstance(); $t = new SimpleSAML_XHTML_Template($config, 'noconsent.php'); $t->data['spmetadata'] = $spmetadata; +if(array_key_exists('resumeFrom', $_REQUEST)) { + $t->data['resumeFrom'] = $_REQUEST['resumeFrom']; +} $t->show(); ?> \ No newline at end of file diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php index 7bed4754c..7f024c75e 100644 --- a/www/saml2/idp/SSOService.php +++ b/www/saml2/idp/SSOService.php @@ -276,7 +276,6 @@ if($needAuth && !$isPassive) { $t->data['header'] = 'Consent'; $t->data['sp_name'] = $sp_name; $t->data['idp_name'] = (isset($idpmetadata['name']) ? $idpmetadata['name'] : $idpentityid); - $t->data['sptype'] = 'saml20-sp-remote'; $t->data['spentityid'] = $spentityid; $t->data['spmetadata'] = $spmetadata; $t->data['attributes'] = $filteredattributes; @@ -285,6 +284,11 @@ if($needAuth && !$isPassive) { $t->data['consent_cookie'] = $requestcache['ConsentCookie']; $t->data['usestorage'] = $consent->useStorage(); $t->data['noconsent'] = '/' . $config->getBaseURL() . 'noconsent.php'; + $t->data['noconsent_data'] = array( + 'sptype' => 'saml20-sp-remote', + 'spentityid' => $spentityid, + 'resumeFrom' => SimpleSAML_Utilities::selfURL(), + ); if (array_key_exists('privacypolicy', $spmetadata)) { $privacypolicy = $spmetadata['privacypolicy']; diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php index 8c2154f7f..9ae15e0ce 100644 --- a/www/shib13/idp/SSOService.php +++ b/www/shib13/idp/SSOService.php @@ -189,7 +189,6 @@ if (!$session->isAuthenticated($authority) ) { $t->data['header'] = 'Consent'; $t->data['sp_name'] = $sp_name; $t->data['idp_name'] = (isset($idpmetadata['name']) ? $idpmetadata['name'] : $idpentityid); - $t->data['sptype'] = 'shib13-sp-remote'; $t->data['spentityid'] = $spentityid; $t->data['spmetadata'] = $spmetadata; $t->data['attributes'] = $filteredattributes; @@ -198,6 +197,11 @@ if (!$session->isAuthenticated($authority) ) { $t->data['consent_cookie'] = $requestcache['ConsentCookie']; $t->data['usestorage'] = $consent->useStorage(); $t->data['noconsent'] = '/' . $config->getBaseURL() . 'noconsent.php'; + $t->data['noconsent_data'] = array( + 'sptype' => 'shib13-sp-remote', + 'spentityid' => $spentityid, + 'resumeFrom' => SimpleSAML_Utilities::selfURL(), + ); if (array_key_exists('privacypolicy', $spmetadata)) { $privacypolicy = $spmetadata['privacypolicy']; -- GitLab