Skip to content

Commit

Permalink
set validUntil using the available MDA stage instead of XSLT
Browse files Browse the repository at this point in the history
See ukf/ukf-meta#145.
  • Loading branch information
iay committed Sep 14, 2017
1 parent 56b985a commit 46e6c9c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@
<property name="mda.sign.pkcs11Config" value="${sign.uk.pkcs11Config}"/>
<property name="mda.mdq.output" value="${mdq.output.dir}"/>
<property name="mda.validUntil.aggregate.days" value="${validUntil.aggregate.days}"/>
<property name="mda.validUntil.aggregate.duration" value="${validUntil.aggregate.duration}"/>
<property name="mda.validUntil.perEntity.duration" value="${validUntil.perEntity.duration}"/>

<!--
Expand Down
20 changes: 7 additions & 13 deletions mdx/uk/final_tweak.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,20 @@
<xsl:param name="validityDays"/>

<xsl:variable name="now" select="date:date-time()"/>
<xsl:variable name="validUntil" select="mdxDates:dateAdd($now, $validityDays)"/>
<xsl:variable name="normalisedNow" select="mdxDates:dateAdd($now, 0)"/>

<!--
Document root.
-->
<xsl:template match="/">
<xsl:call-template name="document.comment"/>
<xsl:apply-templates/>
</xsl:template>

<!--
Document element.
-->
<xsl:template match="/md:EntitiesDescriptor">
<xsl:call-template name="document.comment">
<xsl:with-param name="validUntil" select="@validUntil"/>
</xsl:call-template>
<EntitiesDescriptor>
<xsl:attribute name="validUntil">
<xsl:value-of select="$validUntil"/>
</xsl:attribute>
<xsl:apply-templates select="@*"/>
<xsl:call-template name="document.comment"/>
<xsl:call-template name="document.comment">
<xsl:with-param name="validUntil" select="@validUntil"/>
</xsl:call-template>

<!--
Add an Extensions element if there isn't one, but we need one
Expand All @@ -92,6 +85,7 @@
Comment to be added to the top of the document, and just inside the document element.
-->
<xsl:template name="document.comment">
<xsl:param name="validUntil"/>
<xsl:text>&#10;</xsl:text>
<xsl:comment>
<xsl:text>&#10;&#9;U K F E D E R A T I O N M E T A D A T A&#10;</xsl:text>
Expand Down
41 changes: 34 additions & 7 deletions mdx/uk/generate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
*****************************
-->

<!-- This bean MUST be called "conversionService" to work properly. -->
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="net.shibboleth.ext.spring.config.DurationToLongConverter" />
<bean class="net.shibboleth.ext.spring.config.StringToIPRangeConverter" />
<bean class="net.shibboleth.ext.spring.config.BooleanToPredicateConverter" />
<bean class="net.shibboleth.ext.spring.config.StringBooleanToPredicateConverter" />
<bean class="net.shibboleth.ext.spring.config.StringToResourceConverter" />
</set>
</property>
</bean>

<!--
stripEntityScopes
Expand All @@ -55,6 +68,20 @@
<bean id="finalise_parent" abstract="true" parent="mda.XSLTransformationStage"
p:XSLResource="classpath:uk/final_tweak.xsl"/>

<!--
assembleAggregate
Assemble a UK-style aggregate with an appropriate validUntil.
-->
<bean id="assembleAggregate" parent="mda.CompositeStage">
<property name="composedStages">
<list>
<ref bean="uk_assemble"/>
<bean parent="mda.SetValidUntilStage" p:validityDuration="${validUntil.aggregate.duration}"/>
</list>
</property>
</bean>

<!--
checkPublishable
Expand Down Expand Up @@ -274,7 +301,7 @@
<ref bean="check_dup_display"/>
<ref bean="errorTerminatingFilter"/>

<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>
<ref bean="uk_finaliseProduction"/>
<ref bean="setStaticID"/>
<ref bean="uk_normaliseNamespaces"/>
Expand Down Expand Up @@ -335,7 +362,7 @@
<ref bean="check_dup_display"/>
<ref bean="errorTerminatingFilter"/>

<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>

<!--
Remove embedded images used in mdui:Logo elements.
Expand Down Expand Up @@ -452,7 +479,7 @@
<ref bean="errorTerminatingFilter"/>

<!-- make an aggregate first so that we're only traversing one item -->
<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>

<!-- remove many things that the CDS doesn't look at -->
<ref bean="CDSStripUnwanted"/>
Expand Down Expand Up @@ -516,7 +543,7 @@
<ref bean="check_dup_display"/>
<ref bean="errorTerminatingFilter"/>

<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>
<ref bean="stripEmptyExtensions"/>
<ref bean="uk_finaliseFallback"/>
<ref bean="setStaticID"/>
Expand Down Expand Up @@ -571,7 +598,7 @@
<ref bean="errorTerminatingFilter"/>

<ref bean="uk_strip_UKFederationMember"/>
<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>
<ref bean="stripEntityScopes"/>
<ref bean="uk_finaliseTest"/>
<ref bean="setStaticID"/>
Expand Down Expand Up @@ -696,7 +723,7 @@
<ref bean="errorTerminatingFilter"/>

<ref bean="stripUkfedlabelNamespace"/>
<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>
<ref bean="stripEntityScopes"/>
<ref bean="stripEmptyExtensions"/>
<ref bean="uk_finaliseExport"/>
Expand Down Expand Up @@ -812,7 +839,7 @@
<ref bean="errorTerminatingFilter"/>

<ref bean="stripUkfedlabelNamespace"/>
<ref bean="uk_assemble"/>
<ref bean="assembleAggregate"/>
<ref bean="stripEntityScopes"/>
<ref bean="stripEmptyExtensions"/>
<ref bean="uk_finaliseExport"/>
Expand Down

0 comments on commit 46e6c9c

Please sign in to comment.