Skip to content

Commit

Permalink
Bug 806 - add mdrpi information to export aggregate
Browse files Browse the repository at this point in the history
Adds PublicationInfo to both the export and test aggregates.
Make the header comment a little more helpful during BST.
Consolidate on a single bean for the uk_federation_uri.
  • Loading branch information
iay committed May 24, 2012
1 parent f6ef138 commit 911eac5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 14 deletions.
34 changes: 21 additions & 13 deletions mdx/uk/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!--
uk_federation_uri
URI for the UK federation. Used in several contexts:
* as the Name attribute for the main EntitiesDescriptor in UK federation metadata
(not always the document element)
* in mdrpi:RegistrationInfo, as the unique identifier for the UK federation registrar
* in mdrpi:PublicationInfo, as the unique identifier for the UK federation publisher
-->
<bean id="uk_federation_uri" class="java.lang.String">
<constructor-arg value="http://ukfederation.org.uk"/>
</bean>


<!--
uk_fetchFragmentFiles
Expand Down Expand Up @@ -253,8 +270,8 @@
-->
<bean id="uk_assemble" parent="stage_parent"
class="net.shibboleth.metadata.dom.saml.EntitiesDescriptorAssemblerStage"
p:id="uk_assemble"
p:descriptorName="http://ukfederation.org.uk">
p:id="uk_assemble">
<property name="descriptorName" ref="uk_federation_uri"/>
<property name="itemOrderingStrategy">
<bean class="uk.org.ukfederation.mda.UKEntityOrderingStrategy"/>
</property>
Expand Down Expand Up @@ -345,15 +362,6 @@
*************************************************
-->

<!--
uk_registrar
Unique ID for the registrar associated with this channel.
-->
<bean id="uk_registrar" class="java.lang.String">
<constructor-arg value="http://ukfederation.org.uk"/>
</bean>

<!--
uk_check_regauth
Expand All @@ -364,7 +372,7 @@
p:id="uk_check_regauth">
<property name="transformParameters">
<map>
<entry key="expectedAuthority" value-ref="uk_registrar"/>
<entry key="expectedAuthority" value-ref="uk_federation_uri"/>
</map>
</property>
</bean>
Expand All @@ -379,7 +387,7 @@
p:id="uk_default_regauth">
<property name="transformParameters">
<map>
<entry key="defaultAuthority" value-ref="uk_registrar"/>
<entry key="defaultAuthority" value-ref="uk_federation_uri"/>
</map>
</property>
</bean>
Expand Down
65 changes: 64 additions & 1 deletion mdx/uk/final_tweak.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->
<xsl:stylesheet version="1.0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"

xmlns:date="http://exslt.org/dates-and-times"
xmlns:mdxDates="xalan://uk.ac.sdss.xalan.md.Dates"
Expand All @@ -29,6 +30,14 @@
-->
<xsl:param name="extraText"/>

<!--
publisher
This parameter, if present, prompts the generation of a PublicationInfo
element on the EntitiesDescriptor.
-->
<xsl:param name="publisher"/>

<!--
validityDays
Expand Down Expand Up @@ -75,6 +84,22 @@
</xsl:attribute>
<xsl:apply-templates select="@*"/>
<xsl:call-template name="document.comment"/>

<!--
Add an Extensions element if there isn't one, but we need one
so that we can put a PublicationInfo inside it.
-->
<xsl:if test="$publisher and not(md:Extensions)">
<xsl:text>&#10;</xsl:text>
<xsl:text> </xsl:text>
<xsl:element name="md:Extensions">
<xsl:call-template name="generate.publicationInfo"/>
<xsl:text>&#10;</xsl:text>
<xsl:text> </xsl:text>
</xsl:element>
<xsl:text>&#10;</xsl:text>
</xsl:if>

<xsl:apply-templates select="node()"/>
</EntitiesDescriptor>
</xsl:template>
Expand All @@ -94,7 +119,12 @@
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text>&#9;Aggregate built </xsl:text>
<xsl:value-of select="$now"/>
<xsl:value-of select="$normalisedNow"/>
<xsl:if test="string($normalisedNow) != string($now)">
<xsl:text> (</xsl:text>
<xsl:value-of select="$now"/>
<xsl:text> local)</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text>&#9;Aggregate valid for </xsl:text>
Expand All @@ -105,6 +135,39 @@
</xsl:comment>
</xsl:template>

<!--
Document element's Extensions.
Insert a PublicationInfo at the top, if required.
-->
<xsl:template match="/md:EntitiesDescriptor/md:Extensions">
<xsl:copy>
<xsl:if test="$publisher">
<xsl:call-template name="generate.publicationInfo"/>
</xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!--
PublicationInfo generation.
Assumption: called at the start of the document element's Extensions, at 4-space
indentation, so the element itself requires 8-space indentation.
-->
<xsl:template name="generate.publicationInfo">
<xsl:text>&#10;</xsl:text>
<xsl:text> </xsl:text>
<xsl:element name="mdrpi:PublicationInfo">
<xsl:attribute name="publisher">
<xsl:value-of select="$publisher"/>
</xsl:attribute>
<xsl:attribute name="creationInstant">
<xsl:value-of select="$normalisedNow"/>
</xsl:attribute>
</xsl:element>
</xsl:template>

<!--By default, copy text blocks, comments and attributes unchanged.-->
<xsl:template match="text()|comment()|@*">
<xsl:copy/>
Expand Down
2 changes: 2 additions & 0 deletions mdx/uk/generate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
<property name="transformParameters">
<map>
<entry key="extraText" value="Feature test metadata; not for production use"/>
<entry key="publisher" value-ref="uk_federation_uri"/>
</map>
</property>
</bean>
Expand Down Expand Up @@ -299,6 +300,7 @@
<property name="transformParameters">
<map>
<entry key="extraText" value="Prototype export metadata; not for production use"/>
<entry key="publisher" value-ref="uk_federation_uri"/>
</map>
</property>
</bean>
Expand Down

0 comments on commit 911eac5

Please sign in to comment.