diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php index ba809c07fc418067ec4d3418b1c331c8fee1854b..874de7ec792a5809fe873dced0c58659505adcf7 100644 --- a/modules/core/templates/frontpage_federation.tpl.php +++ b/modules/core/templates/frontpage_federation.tpl.php @@ -75,12 +75,15 @@ foreach($this->data['metaentries']['remote'] AS $setkey => $set) { echo '<ul>'; foreach($set AS $entry) { echo '<li>'; + echo ('<a href="' . + SimpleSAML_Module::getModuleURL('core/show_metadata.php?entityid=' . urlencode($entry['entityid']) . '&set=' . urlencode($setkey) ) . + '">'); if (array_key_exists('name', $entry)) { echo $this->getTranslation(SimpleSAML_Utilities::arrayize($entry['name'], 'en')); } else { echo $entry['entityid']; } - + echo '</a>'; if (array_key_exists('expire', $entry)) { if ($entry['expire'] < $now) { echo('<span style="color: #500; font-weight: bold"> (expired ' . number_format(($now - $entry['expire'])/3600, 1) . ' hours ago)</span>'); @@ -112,13 +115,39 @@ foreach($this->data['metaentries']['remote'] AS $setkey => $set) { ?> </ul> +<?php +if ($this->data['isadmin']) { +?> +<fieldset class="fancyfieldset"><legend>Lookup metadata</legend> + <form action="<?php echo SimpleSAML_Module::getModuleURL('core/show_metadata.php'); ?>" method="get" > + <p style="margin: 1em 2em ">Look up metadata for entity: + <select name="set"> + + <?php + if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { + foreach($this->data['metaentries']['remote'] AS $setkey => $set) { + echo '<option value="' . htmlspecialchars($setkey) . '">' . $this->t(mtype($setkey)) . '</option>'; + } + } + + ?> + + + </select> + <input type="text" name="entityid"> + <input type="submit" value="Lookup"> + </p> + </form> +</fieldset> +<?php +} - +?> diff --git a/modules/core/templates/show_metadata.tpl.php b/modules/core/templates/show_metadata.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..bdef18d8a0a96f214b46f3b07d64a8e274ffeb09 --- /dev/null +++ b/modules/core/templates/show_metadata.tpl.php @@ -0,0 +1,18 @@ +<?php + + + +$this->includeAtTemplateBase('includes/header.php'); + + +echo('<pre style="font-size: 110%">'); + +echo(htmlentities(var_export($this->data['m']))); + +echo('</pre>'); + +echo('<p>[ <a href="' . $this->data['backlink'] . '"> back </a> ]</p>'); + + +$this->includeAtTemplateBase('includes/footer.php'); + diff --git a/modules/core/www/show_metadata.php b/modules/core/www/show_metadata.php new file mode 100644 index 0000000000000000000000000000000000000000..e7647d2e4a8b4ecbcca6a44509e19d7ca7ae8bf5 --- /dev/null +++ b/modules/core/www/show_metadata.php @@ -0,0 +1,36 @@ +<?php + + + +/* Load simpleSAMLphp, configuration */ +$config = SimpleSAML_Configuration::getInstance(); +$session = SimpleSAML_Session::getInstance(); + +SimpleSAML_Utilities::requireAdmin(); + + +if (!array_key_exists('entityid', $_REQUEST)) + throw new Exception('required parameter [entityid] missing'); +if (!array_key_exists('set', $_REQUEST)) + throw new Exception('required parameter [set] missing'); +if (!in_array($_REQUEST['set'], array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote'))) + throw new Exception('Invalid set'); + + +$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); + +$m = $metadata->getMetadata($_REQUEST['entityid'], $_REQUEST['set']); + +// echo('<pre>'); print_r($m); +// exit; + + +$t = new SimpleSAML_XHTML_Template($config, 'core:show_metadata.tpl.php'); +$t->data['pageid'] = 'show_metadata'; +$t->data['header'] = 'simpleSAMLphp Show Metadata'; +$t->data['backlink'] = SimpleSAML_Module::getModuleURL('core/frontpage_federation.php'); +$t->data['m'] = $m; + + +$t->show(); +