From b172d4a62a2af9355b91b9dc92bdcf905bbe3b68 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 4 Aug 2008 13:26:09 +0000
Subject: [PATCH] Consent: Include SP metadata in noconsent error page.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@796 44740490-163a-0410-bde0-09ae8108e29a
---
 templates/default/consent.php | 6 ++++++
 www/noconsent.php             | 7 +++++++
 www/saml2/idp/SSOService.php  | 1 +
 www/shib13/idp/SSOService.php | 1 +
 4 files changed, 15 insertions(+)

diff --git a/templates/default/consent.php b/templates/default/consent.php
index 2ad7c0750..566b85db5 100644
--- a/templates/default/consent.php
+++ b/templates/default/consent.php
@@ -27,6 +27,12 @@
 			<?php } ?>
 		</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']) . '" />');
+}
+?>
 			<input type="submit" id="nobutton" value="<?php echo htmlspecialchars($this->t('no')) ?>" />
 		</form>
 		<p>
diff --git a/www/noconsent.php b/www/noconsent.php
index b592d97f8..6d6e0a8b5 100644
--- a/www/noconsent.php
+++ b/www/noconsent.php
@@ -2,11 +2,18 @@
 
 require_once('_include.php');
 
+if(array_key_exists('sptype', $_GET) && array_key_exists('spentityid', $_GET)) {
+	$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
+	$spmetadata = $metadata->getMetaData($_GET['spentityid'], $_GET['sptype']);
+} else {
+	$spmetadata = array();
+}
 /* Load simpleSAMLphp, configuration */
 $config = SimpleSAML_Configuration::getInstance();
 $session = SimpleSAML_Session::getInstance();
 
 $t = new SimpleSAML_XHTML_Template($config, 'noconsent.php');
+$t->data['spmetadata'] = $spmetadata;
 $t->show();
 
 ?>
\ No newline at end of file
diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php
index 8fe095a01..7bed4754c 100644
--- a/www/saml2/idp/SSOService.php
+++ b/www/saml2/idp/SSOService.php
@@ -276,6 +276,7 @@ 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;
diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php
index 3744e5144..41ad67436 100644
--- a/www/shib13/idp/SSOService.php
+++ b/www/shib13/idp/SSOService.php
@@ -188,6 +188,7 @@ 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;
-- 
GitLab