diff --git a/modules/aggregator/docs/aggregator.txt b/modules/aggregator/docs/aggregator.txt
index fdef423c..bff3c31c 100644
--- a/modules/aggregator/docs/aggregator.txt
+++ b/modules/aggregator/docs/aggregator.txt
@@ -84,8 +84,8 @@ The endpoint supports the following query parameter:
`exclude`
: Specify a `tag` that will be excluded from the metadata set. Useful for leaving out your own federation metadata.
-`format`
-: Select the Mime-Type that will be used. Can be `txt` or `xml`.
+`mimetype`
+: Select the Mime-Type that will be used. Default is `application/samlmetadata+xml`.
diff --git a/modules/aggregator/templates/list.php b/modules/aggregator/templates/list.php
index d9ab5241..47362c2c 100644
--- a/modules/aggregator/templates/list.php
+++ b/modules/aggregator/templates/list.php
@@ -15,8 +15,8 @@ if (count($this->data['sources']) === 0) {
$encName = htmlspecialchars($source);
echo('
');
echo('' . $encName . '');
- echo(' [' . $this->t('{aggregator:aggregator:text}') . ']');
- echo(' [xml]');
+ echo(' [' . $this->t('{aggregator:aggregator:text}') . ']');
+ echo(' [xml]');
echo('');
}
@@ -24,4 +24,3 @@ if (count($this->data['sources']) === 0) {
}
$this->includeAtTemplateBase('includes/footer.php');
-?>
\ No newline at end of file
diff --git a/modules/aggregator/www/arp.php b/modules/aggregator/www/arp.php
index 4f7ca121..3c05d225 100644
--- a/modules/aggregator/www/arp.php
+++ b/modules/aggregator/www/arp.php
@@ -15,7 +15,7 @@ if (!array_key_exists('id', $_GET)) {
exit;
}
$id = $_GET['id'];
-if (!in_array($id, $aggregators->getOptions()))
+if (!in_array($id, $aggregators->getOptions()))
throw new SimpleSAML_Error_NotFound('No aggregator with id ' . var_export($id, TRUE) . ' found.');
$aConfig = $aggregators->getConfigItem($id);
@@ -23,10 +23,10 @@ $aConfig = $aggregators->getConfigItem($id);
$aggregator = new sspmod_aggregator_Aggregator($gConfig, $aConfig, $id);
-if (isset($_REQUEST['set']))
+if (isset($_REQUEST['set']))
$aggregator->limitSets($_REQUEST['set']);
-if (isset($_REQUEST['exclude']))
+if (isset($_REQUEST['exclude']))
$aggregator->exclude($_REQUEST['exclude']);
@@ -66,18 +66,21 @@ if ($aggregator->shouldSign()) {
$signer->sign($firstelement, $firstelement, $firstelement->firstChild);
}
-$format = 'application/samlmetadata+xml';
+$mimetype = 'application/samlmetadata-xml';
+$allowedmimetypes = array(
+ 'text/plain',
+ 'application/samlmetadata-xml',
+ 'application/xml',
+);
-/* Show the metadata. */
-if(array_key_exists('format', $_GET)) {
- if ($_GET['format'] === "txt") {
- $format = 'text/plain';
- }
+if (isset($_GET['mimetype']) && in_array($_GET['mimetype'], $allowedmimetypes)) {
+ $mimetype = $_GET['mimetype'];
}
-header('Content-Type: ' . $format);
+if ($mimetype === 'text/plain') {
+ SimpleSAML_Utilities::formatDOMElement($xml->documentElement);
+}
+
+header('Content-Type: ' . $mimetype);
echo($xml->saveXML());
-
-
-?>
\ No newline at end of file
diff --git a/modules/aggregator/www/index.php b/modules/aggregator/www/index.php
index 76c37f7c..1b1049ab 100644
--- a/modules/aggregator/www/index.php
+++ b/modules/aggregator/www/index.php
@@ -15,7 +15,7 @@ if (!array_key_exists('id', $_GET)) {
exit;
}
$id = $_GET['id'];
-if (!in_array($id, $aggregators->getOptions()))
+if (!in_array($id, $aggregators->getOptions()))
throw new SimpleSAML_Error_NotFound('No aggregator with id ' . var_export($id, TRUE) . ' found.');
$aConfig = $aggregators->getConfigItem($id);
@@ -23,7 +23,7 @@ $aConfig = $aggregators->getConfigItem($id);
$aggregator = new sspmod_aggregator_Aggregator($gConfig, $aConfig, $id);
-if (isset($_REQUEST['set']))
+if (isset($_REQUEST['set']))
$aggregator->limitSets($_REQUEST['set']);
if (isset($_REQUEST['exclude']))
@@ -32,19 +32,24 @@ if (isset($_REQUEST['exclude']))
$xml = $aggregator->getMetadataDocument();
-$format = 'application/samlmetadata+xml';
+$mimetype = 'application/samlmetadata+xml';
+$allowedmimetypes = array(
+ 'text/plain',
+ 'application/samlmetadata-xml',
+ 'application/xml',
+);
-/* Show the metadata. */
-if(array_key_exists('format', $_GET)) {
- if ($_GET['format'] === "txt") {
- SimpleSAML_Utilities::formatDOMElement($xml);
- $format = 'text/plain';
- }
+if (isset($_GET['mimetype']) && in_array($_GET['mimetype'], $allowedmimetypes)) {
+ $mimetype = $_GET['mimetype'];
+}
+
+if ($mimetype === 'text/plain') {
+ SimpleSAML_Utilities::formatDOMElement($xml);
}
$metadata = ''."\n".$xml->ownerDocument->saveXML($xml);
-header('Content-Type: ' . $format);
+header('Content-Type: ' . $mimetype);
header('Content-Length: ' . strlen($metadata));
echo $metadata;