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

Throw exception when no public key was found in metadata XML document.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1028 44740490-163a-0410-bde0-09ae8108e29a
parent b4070a06
No related branches found
No related tags found
No related merge requests found
...@@ -61,14 +61,14 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource { ...@@ -61,14 +61,14 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource {
} }
switch($type) { switch($type) {
case 'flatfile': case 'flatfile':
return new SimpleSAML_Metadata_MetaDataStorageHandlerFlatFile($sourceConfig); return new SimpleSAML_Metadata_MetaDataStorageHandlerFlatFile($sourceConfig);
case 'xml': case 'xml':
return new SimpleSAML_Metadata_MetaDataStorageHandlerXML($sourceConfig); return new SimpleSAML_Metadata_MetaDataStorageHandlerXML($sourceConfig);
case 'dynamicxml': case 'dynamicxml':
return new SimpleSAML_Metadata_MetaDataStorageHandlerDynamicXML($sourceConfig); return new SimpleSAML_Metadata_MetaDataStorageHandlerDynamicXML($sourceConfig);
default: default:
throw new Exception('Invalid metadata source type: "' . $type . '".'); throw new Exception('Invalid metadata source type: "' . $type . '".');
} }
} }
......
...@@ -598,6 +598,11 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -598,6 +598,11 @@ 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($idp['keys'] as $key) {
if($key['type'] !== 'X509Certificate') { if($key['type'] !== 'X509Certificate') {
......
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