From 3a5ad3b89405c6aaea69169bf7b4ac46fb0e6b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Sat, 29 Nov 2008 04:50:23 +0000 Subject: [PATCH] reverted last fix. cert is not required at sp. instead fixed a typo. spd instead of idp git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1029 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Metadata/SAMLParser.php | 8 +++----- modules/aggregator/www/index.php | 6 ++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 3981c865b..fdd8fd5b3 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -598,13 +598,9 @@ class SimpleSAML_Metadata_SAMLParser { $ret['NameIDFormat'] = $spd['nameIDFormats'][0]; } - // Require that a certificate is embedded - if (!is_array($idp['keys'])) { - throw new Exception('Could not find any embedded certificates in metadata document.'); - } /* Add certificate data. Only the first valid certificate will be added. */ - foreach($idp['keys'] as $key) { + foreach($spd['keys'] as $key) { if($key['type'] !== 'X509Certificate') { continue; } @@ -623,6 +619,8 @@ class SimpleSAML_Metadata_SAMLParser { /* Add organization info. */ $this->addOrganizationInfo($ret); + + return $ret; } diff --git a/modules/aggregator/www/index.php b/modules/aggregator/www/index.php index fe5cd0cb2..3afe2d0ff 100644 --- a/modules/aggregator/www/index.php +++ b/modules/aggregator/www/index.php @@ -59,6 +59,9 @@ foreach ($sources as $source) { } } + + + $xml = new DOMDocument(); $entitiesDescriptor = $xml->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', 'EntitiesDescriptor'); $entitiesDescriptor->setAttribute('Name', $id); @@ -107,6 +110,7 @@ foreach ($entities as $entity => $sets) { $entitiesDescriptor->appendChild($xml->importNode($entityDescriptor, TRUE)); } + /* Sign the metadata if enabled. */ if ($aggregatorConfig->getBoolean('sign.enable', FALSE)) { $privateKey = $aggregatorConfig->getString('sign.privatekey'); @@ -122,12 +126,14 @@ if ($aggregatorConfig->getBoolean('sign.enable', FALSE)) { $signer->sign($entitiesDescriptor, $entitiesDescriptor, $entitiesDescriptor->firstChild); } + /* Show the metadata. */ if(array_key_exists('mimetype', $_GET)) { $mimeType = $_GET['mimetype']; } else { $mimeType = 'application/samlmetadata+xml'; } + header('Content-Type: ' . $mimeType); echo($xml->saveXML()); -- GitLab