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

Add support for excluding tags in metadata aggregator

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1503 44740490-163a-0410-bde0-09ae8108e29a
parent 11c992d6
No related branches found
No related tags found
No related merge requests found
......@@ -40,28 +40,36 @@ try {
var_export($id, TRUE) . ': ' . $e->getMessage());
}
$exclude = NULL;
if (array_key_exists('exclude', $_REQUEST)) $exclude = $_REQUEST['exclude'];
#echo $exclude; exit;
/* Find list of all available entities. */
$entities = array();
foreach ($sources as $source) {
foreach ($metadataSets as $set) {
foreach ($source->getMetadataSet($set) as $entityId => $metadata) {
if (!array_key_exists($entityId, $entities)) {
$entities[$entityId] = array();
if (isset($exclude) &&
array_key_exists('tags', $metadata) &&
in_array($exclude, $metadata['tags'])) {
SimpleSAML_Logger::debug('Excluding entity ID [' . $entityId . '] becuase it is tagged with [' . $exclude . ']');
continue;
} else {
#echo('<pre>'); print_r($metadata); exit;
}
if (!array_key_exists($entityId, $entities))
$entities[$entityId] = array();
if (array_key_exists($set, $entities[$entityId])) {
/* Entity already has metadata for the given set. */
continue;
}
$entities[$entityId][$set] = $metadata;
}
}
}
$xml = new DOMDocument();
$entitiesDescriptor = $xml->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', 'EntitiesDescriptor');
$entitiesDescriptor->setAttribute('Name', $id);
......
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