Skip to content

Commit

Permalink
Generate and publish list of SPs which assert R&S entity category
Browse files Browse the repository at this point in the history
Adds new generate.html.randssps target which extracts details
about SPs which assert the R&S entity category, and processes
them into HTML suitable for the website.

Also updates the publish.generated.html target to push the
HTML to webserver stats directory.

See ukf/ukf-meta#283 for details
  • Loading branch information
Alex Stuart committed Dec 15, 2020
1 parent f8bc440 commit 548978b
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Thumbs.db
# /build/
/build/locations.txt
/build/orgnamescope.html
/build/randssps.html

# /charting/
/charting/cache
Expand Down
20 changes: 20 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2390,6 +2390,11 @@
<include name="orgnamescope.html"/>
</fileset>
</scp>
<scp failonerror="true" remoteTodir="${www.url.stats}" keyfile="~/.ssh/id_rsa" knownhosts="~/.ssh/known_hosts">
<fileset dir="${build.dir}">
<include name="randssps.html"/>
</fileset>
</scp>
</then>
</if>
</target>
Expand Down Expand Up @@ -2810,6 +2815,21 @@
</exec>
</target>

<!--
generate.html.randssps
Generates a HTML table of SPs which assert the R&S entity category
-->
<target name="generate.html.randssps">
<echo>Running generate.html.randssps XSLT</echo>
<exec executable="xsltproc" failonerror="true">
<arg value="--output" />
<arg value="${build.dir}/randssps.html" />
<arg value="${utilities.dir}/list_rands_sps.xsl" />
<arg value="${aggregates.dir}/ukfederation-metadata.xml" />
</exec>
</target>

<!--
echoproperties
Expand Down
126 changes: 126 additions & 0 deletions utilities/list_rands_sps.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
list_rands_sps.xsl
Lists SPs which assert they are Research and Scholarship (R&S)
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute"
xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata">

<xsl:output method="text" encoding="UTF-8"/>

<xsl:template match="//md:EntitiesDescriptor">
<xsl:text>&lt;!DOCTYPE html&gt;&#10;</xsl:text>
<xsl:text>&lt;html lang="en"&gt;&#10;</xsl:text>
<xsl:text>&lt;head&gt;&#10;</xsl:text>
<xsl:text>&lt;title&gt;</xsl:text>
<xsl:text>List of SPs asserting the Research and Scholarship entity category</xsl:text>
<xsl:text>&lt;/title&gt;&#10;</xsl:text>
<xsl:text>&lt;meta charset="UTF-8"&gt;&#10;</xsl:text>
<xsl:text>&lt;/head&gt;&#10;</xsl:text>
<xsl:text>&lt;body&gt;&#10;</xsl:text>
<xsl:text>&lt;h1&gt;</xsl:text>
<xsl:text>List of SPs asserting the Research and Scholarship entity category</xsl:text>
<xsl:text>&lt;/h1&gt;&#10;</xsl:text>
<xsl:apply-templates />
</xsl:template>

<!-- Select SPs which assert R&S entity category -->
<xsl:template match="md:EntityDescriptor
[md:Extensions/mdattr:EntityAttributes/saml:Attribute
[@NameFormat='urn:oasis:names:tc:SAML:2.0:attrname-format:uri']
[@Name='http://macedir.org/entity-category']
/saml:AttributeValue[.='http://refeds.org/category/research-and-scholarship']
]">
<xsl:text>&lt;h2&gt;</xsl:text>
<!-- Display name -->
<xsl:value-of select="md:SPSSODescriptor/md:Extensions/mdui:UIInfo/mdui:DisplayName[@xml:lang='en']" />
<xsl:text>&lt;/h2&gt;&#10;</xsl:text>
<!-- table header -->
<xsl:text>&lt;table&gt;&#10;</xsl:text>
<!-- entityID -->
<xsl:call-template name="row">
<xsl:with-param name="label"><xsl:text>entityID</xsl:text></xsl:with-param>
<xsl:with-param name="value" select="./@entityID"/>
</xsl:call-template>
<!-- registrationAuthority -->
<xsl:call-template name="row">
<xsl:with-param name="label"><xsl:text>registrationAuthority</xsl:text></xsl:with-param>
<xsl:with-param name="value" select="md:Extensions/mdrpi:RegistrationInfo/@registrationAuthority"/>
</xsl:call-template>
<!-- InformationURL (is mandatory, but xml:lang='en' is only recommended) -->
<xsl:choose>
<xsl:when test="md:SPSSODescriptor/md:Extensions/mdui:UIInfo/mdui:InformationURL[@xml:lang='en']">
<xsl:call-template name="row">
<xsl:with-param name="label"><xsl:text>InformationURL</xsl:text></xsl:with-param>
<xsl:with-param name="value">
<xsl:text>&lt;a href=&quot;</xsl:text>
<xsl:value-of select="md:SPSSODescriptor/md:Extensions/mdui:UIInfo/mdui:InformationURL[@xml:lang='en']"/>
<xsl:text>&quot;&gt;</xsl:text>
<xsl:value-of select="md:SPSSODescriptor/md:Extensions/mdui:UIInfo/mdui:InformationURL[@xml:lang='en']"/>
<xsl:text>&lt;/a&gt;</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="row">
<xsl:with-param name="label"><xsl:text>InformationURL</xsl:text></xsl:with-param>
<xsl:with-param name="value"><xsl:text>No English language version available</xsl:text></xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- Description -->
<xsl:call-template name="row">
<xsl:with-param name="label"><xsl:text>Description</xsl:text></xsl:with-param>
<xsl:with-param name="value" select="md:SPSSODescriptor/md:Extensions/mdui:UIInfo/mdui:Description[@xml:lang='en']"/>
</xsl:call-template>
<!-- table footer -->
<xsl:text>&lt;/table&gt;&#10;</xsl:text>
</xsl:template>

<xsl:template match="text()">
<!-- do nothing -->
</xsl:template>

<xsl:template name="row">
<xsl:param name="label"/>
<xsl:param name="value"/>
<xsl:text>&lt;tr&gt;&#10;</xsl:text>
<xsl:call-template name="cellth">
<xsl:with-param name="content">
<xsl:value-of select="$label" />
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="celltd">
<xsl:with-param name="content">
<xsl:value-of select="$value" />
</xsl:with-param>
</xsl:call-template>
<xsl:text>&lt;/tr&gt;&#10;</xsl:text>
</xsl:template>

<xsl:template name="cellth">
<xsl:param name="content"/>
<xsl:text>&#09;&lt;th&gt;</xsl:text>
<xsl:value-of select="$content" />
<xsl:text>&lt;/th&gt;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>

<xsl:template name="celltd">
<xsl:param name="content"/>
<xsl:text>&#09;&lt;td&gt;</xsl:text>
<xsl:value-of select="$content" />
<xsl:text>&lt;/td&gt;</xsl:text>
<xsl:text>&#10;</xsl:text>
</xsl:template>

</xsl:stylesheet>

0 comments on commit 548978b

Please sign in to comment.