Skip to content

Commit 5657c3c

Browse files
Support retrieving subset of all metadata + fix typo in configuration file + more robust http metadata download
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1524 44740490-163a-0410-bde0-09ae8108e29a
1 parent 1708939 commit 5657c3c

4 files changed

Lines changed: 30 additions & 13 deletions

File tree

lib/SimpleSAML/Metadata/SAMLParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public static function parseDescriptorsFile($file) {
272272

273273
$doc = new DOMDocument();
274274

275-
$res = $doc->load($file);
275+
$res = @$doc->load($file);
276276
if($res !== TRUE) {
277277
throw new Exception('Failed to read XML from file: ' . $file);
278278
}

modules/aggregator/config-templates/aggregator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
$config = array(
55

66
/* List of aggregators. */
7-
'aggragators' => array(
7+
'aggregators' => array(
88
'example' => array(
99
array('type' => 'flatfile'), /* Metadata from metadata-directory. */
1010
array('type' => 'xml', 'url' => 'https://idp.example.org/Metadata'),

modules/aggregator/www/index.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
<?php
22

3-
/* Types of metadata. */
4-
$metadataSets = array(
5-
'saml20-idp-remote',
6-
'saml20-sp-remote',
7-
'shib13-idp-remote',
8-
'shib13-sp-remote',
9-
);
10-
113
$globalConfig = SimpleSAML_Configuration::getInstance();
124
$aggregatorConfig = SimpleSAML_Configuration::getConfig('aggregator.php');
135

146

157
$reconstruct = $aggregatorConfig->getBoolean('reconstruct', FALSE);
16-
$aggregators = $aggregatorConfig->getArray('aggragators');
8+
$aggregators = $aggregatorConfig->getArray('aggregators');
9+
10+
$metadataSets = array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote');
11+
if ($aggregatorConfig->hasValue('default-set')) {
12+
$metadataSets = $aggregatorConfig->getArray('default-set');
13+
}
14+
if (isset($_REQUEST['set'])) {
15+
switch($_REQUEST) {
16+
case 'saml2' :
17+
$metadataSets = array('saml20-idp-remote', 'saml20-sp-remote'); break;
18+
case 'shib13' :
19+
$metadataSets = array('shib13-idp-remote', 'shib13-sp-remote'); break;
20+
case 'idp' :
21+
$metadataSets = array('saml20-idp-remote', 'shib13-idp-remote'); break;
22+
case 'sp' :
23+
$metadataSets = array('saml20-sp-remote', 'shib13-sp-remote'); break;
24+
25+
default:
26+
$metadataSets = array($_REQUEST['set']);
27+
}
28+
}
1729

1830
if (!array_key_exists('id', $_GET)) {
1931
$t = new SimpleSAML_XHTML_Template($globalConfig, 'aggregator:list.php');

modules/metarefresh/lib/MetaLoader.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ public function __construct($expire = NULL) {
2929
* @param $src Filename of the metadata file.
3030
*/
3131
public function loadSource($source) {
32-
33-
$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsFile($source['src']);
32+
33+
$entities = array();
34+
try {
35+
$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsFile($source['src']);
36+
} catch(Exception $e) {
37+
SimpleSAML_Logger::warning('metarefresh: Failed to retrieve metadata. ' . $e->getMessage());
38+
}
3439
$ca = NULL;
3540
foreach($entities as $entity) {
3641
if(array_key_exists('validateFingerprint', $source) && $source['validateFingerprint'] !== NULL) {

0 commit comments

Comments
 (0)