diff --git a/templates/metadata.php b/modules/saml/templates/metadata.php similarity index 100% rename from templates/metadata.php rename to modules/saml/templates/metadata.php diff --git a/modules/saml/templates/metadata.twig b/modules/saml/templates/metadata.twig new file mode 100644 index 0000000000000000000000000000000000000000..4d3903533689fcb890d6d5cbd51077de9e285ba7 --- /dev/null +++ b/modules/saml/templates/metadata.twig @@ -0,0 +1,62 @@ +{% set pagetile = 'SimpleSAMLphp Show Metadata'|trans %} +{% extends 'base.twig' %} +{% block content %} + <h2>{% trans %}Metadata{% endtrans %}</h2> + <dl> + <dd>{{ metadata_intro }}</dd> + + {% if metaurl is defined %} + <dd>{% trans %}You can get the metadata xml on a dedicated URL:{% endtrans %}</dd> + <dd class="code-box hljs"> + <div class="pure-button-group top-right-corner"> + <a class="pure-button copy hljs" data-clipboard-target="#url" + title="{% trans %}Copy to clipboard{% endtrans %}"><span class="fa fa-copy"></span></a> + <a class="pure-button hljs" href="{{ metaurl }}"> + <span class="fa fa-external-link-square"></span> + </a> + </div> + <code id="url" class="code-box-content">{{ metaurl }}</code> + </dd> + {% endif %} + + <dt>{% trans %}SAML Metadata{% endtrans %}</dt> + <dd>{% trans %}In SAML 2.0 Metadata XML format:{% endtrans %}</dd> + <dd class="code-box hljs"> + <div class="pure-button-group top-right-corner"> + <a class="pure-button copy hljs" data-clipboard-target="#xml-metadata" + title="{% trans %}Copy to clipboard{% endtrans %}"><span class="fa fa-copy"></span></a> + </div> + <div id="xml-metadata" class="code-box-content xml">{{ metadata|raw }}</div> + </dd> + <dt>{% trans %}SimpleSAMLphp Metadata{% endtrans %}</dt> + <dd>{% trans %}Use this if you are using a SimpleSAMLphp entity on + {#- #} the other side:{% endtrans %}</dd> + <dd class="code-box hljs"> + <div class="pure-button-group top-right-corner"> + <a class="pure-button copy hljs" data-clipboard-target="#php-metadata" + title="{% trans %}Copy to clipboard{% endtrans %}"><span class="fa fa-copy"></span></a> + </div> + <div id="php-metadata" class="code-box-content php"> + {#- #}{{ metadataflat|raw }}{# -#} + </div> + </dd> + {% if certdata is defined %} + <dt>{% trans %}Certificates{% endtrans %}</dt> + <p>{% trans %}Download the X509 certificates as PEM-encoded files.{% endtrans %}</p> + + <ul> + {% for cert in certdata %} + + <li> + <a href="{{ cert.url }}"><i class="fa fa-download"></i>{{ cert.name }} + {#- #}{% if cert.signing %}-signing{% endif %} + {#- #}{% if cert.encryption %}-encryption{% endif %}.pem + {#- #}{% if cert.prefix %} ({% trans %}new{% endtrans %}){% endif %}</a> {{ cert.comment }} + </li> + {% endfor %} + + </ul> + {% endif %} + + </dl> +{% endblock content %} \ No newline at end of file diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index 1289d31e9880e28f0a9b54b0e3fd4a0ff7ab5575..f82f3105c81bc5c26cda92620b7ed846a58c44f0 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -268,7 +268,7 @@ if (isset($metaArray20['attributes']) && is_array($metaArray20['attributes'])) { $xml = \SimpleSAML\Metadata\Signer::sign($xml, $spconfig->toArray(), 'SAML 2 SP'); if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] == 'xhtml') { - $t = new \SimpleSAML\XHTML\Template($config, 'metadata.php', 'admin'); + $t = new \SimpleSAML\XHTML\Template($config, 'saml:metadata.php', 'admin'); $t->data['clipboard.js'] = true; $t->data['header'] = 'saml20-sp'; // TODO: Replace with headerString in 2.0 diff --git a/templates/metadata.twig b/templates/metadata.twig deleted file mode 100644 index cac105104175c14125ce4fdeeac456d3fad2b6bc..0000000000000000000000000000000000000000 --- a/templates/metadata.twig +++ /dev/null @@ -1,54 +0,0 @@ -{% set pagetile = 'SimpleSAMLphp Show Metadata'|trans %} -{% extends 'base.twig' %} -{% block content %} - <h2>{{ header }}</h2> - <p>{{ metadata_intro }}</p> - -{% if metaurl is defined %} - <p>{{ 'You can get the metadata xml on a dedicated URL:' | trans }}</p> - <div class="input-group"> - <pre id="metadataurl" class="input-left">{{ metaurl }}</pre> - <button data-clipboard-target="#metadataurl" id="btnurl" class="pure-button right clipboard-btn copy"> - <span class="fa fa-copy"></span> - </button> - </div> -{% endif %} - - <h2>{{ 'Metadata' | trans }}</h2> - <div class="code-box"> - <div class="code-box-title"> - <p>{{ 'In SAML 2.0 Metadata XML format:' | trans }}</p> - <button data-clipboard-target="#xmlmetadata" id="btnxml" class="pure-button right clipboard-btn copy"> - <span class="fa fa-copy"></span> - </button> - </div> - <div class="code-box-content"> - <pre id="xmlmetadata">{{ metadata | raw }}</pre> - </div> - </div> - - <div class="code-box"> - <div class="code-box-title"> - <p>{{ 'In SimpleSAMLphp flat file format - use this if you are using a SimpleSAMLphp entity on the other side:' | trans }}</p> - <button data-clipboard-target="#phpmetadata" id="btnphp" class="pure-button right clipboard-btn copy"> - <span class="fa fa-copy"></span> - </button> - </div> - <div class="code-box-content"> - <pre id="phpmetadata">{{ metadataflat | raw }}</pre> - </div> - </div> - -{% if certdata is defined %} - <h2>{{ 'Certificates' |trans }}</h2> - <p>{{ 'Download the X509 certificates as PEM-encoded files.' |trans }}</p> - - <ul> - {% for cert in certdata %} - <li><a href="{{ cert.url }}">{{ cert.name }}</a> {{ cert.comment }}</li> - {% endfor %} - </ul> - -{% endif %} - -{% endblock content %}