Skip to content
Snippets Groups Projects
Commit 3a5ad3b8 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

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
parent 66cfccd5
No related branches found
No related tags found
No related merge requests found
...@@ -598,13 +598,9 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -598,13 +598,9 @@ class SimpleSAML_Metadata_SAMLParser {
$ret['NameIDFormat'] = $spd['nameIDFormats'][0]; $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. */ /* 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') { if($key['type'] !== 'X509Certificate') {
continue; continue;
} }
...@@ -623,6 +619,8 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -623,6 +619,8 @@ class SimpleSAML_Metadata_SAMLParser {
/* Add organization info. */ /* Add organization info. */
$this->addOrganizationInfo($ret); $this->addOrganizationInfo($ret);
return $ret; return $ret;
} }
......
...@@ -59,6 +59,9 @@ foreach ($sources as $source) { ...@@ -59,6 +59,9 @@ foreach ($sources as $source) {
} }
} }
$xml = new DOMDocument(); $xml = new DOMDocument();
$entitiesDescriptor = $xml->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', 'EntitiesDescriptor'); $entitiesDescriptor = $xml->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', 'EntitiesDescriptor');
$entitiesDescriptor->setAttribute('Name', $id); $entitiesDescriptor->setAttribute('Name', $id);
...@@ -107,6 +110,7 @@ foreach ($entities as $entity => $sets) { ...@@ -107,6 +110,7 @@ foreach ($entities as $entity => $sets) {
$entitiesDescriptor->appendChild($xml->importNode($entityDescriptor, TRUE)); $entitiesDescriptor->appendChild($xml->importNode($entityDescriptor, TRUE));
} }
/* Sign the metadata if enabled. */ /* Sign the metadata if enabled. */
if ($aggregatorConfig->getBoolean('sign.enable', FALSE)) { if ($aggregatorConfig->getBoolean('sign.enable', FALSE)) {
$privateKey = $aggregatorConfig->getString('sign.privatekey'); $privateKey = $aggregatorConfig->getString('sign.privatekey');
...@@ -122,12 +126,14 @@ if ($aggregatorConfig->getBoolean('sign.enable', FALSE)) { ...@@ -122,12 +126,14 @@ if ($aggregatorConfig->getBoolean('sign.enable', FALSE)) {
$signer->sign($entitiesDescriptor, $entitiesDescriptor, $entitiesDescriptor->firstChild); $signer->sign($entitiesDescriptor, $entitiesDescriptor, $entitiesDescriptor->firstChild);
} }
/* Show the metadata. */ /* Show the metadata. */
if(array_key_exists('mimetype', $_GET)) { if(array_key_exists('mimetype', $_GET)) {
$mimeType = $_GET['mimetype']; $mimeType = $_GET['mimetype'];
} else { } else {
$mimeType = 'application/samlmetadata+xml'; $mimeType = 'application/samlmetadata+xml';
} }
header('Content-Type: ' . $mimeType); header('Content-Type: ' . $mimeType);
echo($xml->saveXML()); echo($xml->saveXML());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment