Skip to content

Commit

Permalink
Move a couple of UK registrar conventions to a new checking rule that…
Browse files Browse the repository at this point in the history
… is only applied to UK-registered metadata.
  • Loading branch information
iay committed Jun 13, 2011
1 parent d84534c commit cbec910
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 39 deletions.
20 changes: 7 additions & 13 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
<!-- [2] -->
<XALAN.xmldir x="master_ukfederation.xsl" i="${master.file.name}"
o="${uk.master.file}" />
<CHECK i="${xml.dir}/${uk.master.file}" s="check.xsl"/>
<CHECK.ukreg i="${xml.dir}/${uk.master.file}"/>
</target>

<target name="test.uk.future" depends="gen.uk.unsigned">
Expand Down Expand Up @@ -537,7 +537,7 @@
<echo>Generating test federation master file.</echo>
<XALAN.xmldir x="master_ukfederation.xsl" i="${master.file.name}"
o="${test.master.file}" />
<CHECK i="${xml.dir}/${test.master.file}" s="check.xsl"/>
<CHECK.ukreg i="${xml.dir}/${test.master.file}"/>

<!--
Process through to final form.
Expand Down Expand Up @@ -1015,25 +1015,19 @@
</macrodef>

<!--
Check a metadata document against a set of conventions.
Check a metadata document against the full set of conventions used by the
UK federation's registrar function.
Parameter 'i' is the file to be checked; no assumption is made
about its location so this must contain a full path.
Parameter 's' is the primary checking stylesheet to use; assumed to be
present in the build.dir.
A fixed set of additional checking stylesheets are included in every run;
the one passed as a parameter should only contain rules specific to the
calling context.
-->
<macrodef name="CHECK">
<macrodef name="CHECK.ukreg">
<attribute name="i"/>
<attribute name="s"/>
<sequential>
<CHECK.std i="@{i}">
<!-- single context-dependent ruleset -->
<arg value="${build.dir}/@{s}"/>
<arg value="${build.dir}/check_ukreg.xsl"/>
<arg value="${build.dir}/check.xsl"/>
</CHECK.std>
</sequential>
</macrodef>
Expand Down
26 changes: 0 additions & 26 deletions build/check_misc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@
</xsl:template>


<!--
Check for entities which do not have an OrganizationName at all.
-->
<xsl:template match="md:EntityDescriptor[not(md:Organization/md:OrganizationName)]">
<xsl:call-template name="error">
<xsl:with-param name="m">entity lacks OrganizationName</xsl:with-param>
</xsl:call-template>
</xsl:template>


<!--
Check for role descriptors with missing KeyDescriptor elements.
-->
Expand Down Expand Up @@ -201,22 +191,6 @@
</xsl:template>


<!--
Check for https:// locations that use an explicit but redundant port specifier.
-->
<xsl:template match="*[@Location and starts-with(@Location, 'https://')
and contains(@Location,':443/')]">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:value-of select='local-name()'/>
<xsl:text> Location </xsl:text>
<xsl:value-of select="@Location"/>
<xsl:text> not in standard form</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:template>


<!--
Check for Locations that aren't valid URLs.
-->
Expand Down
49 changes: 49 additions & 0 deletions build/check_ukreg.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
check_ukreg.xsl
Checking ruleset containing rules that only apply to metadata registered
by the UK federation's registrar function.
Author: Ian A. Young <ian@iay.org.uk>
-->
<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="urn:oasis:names:tc:SAML:2.0:metadata">

<!--
Common support functions.
-->
<xsl:import href="check_framework.xsl"/>


<!--
Check for entities which do not have an OrganizationName at all.
-->
<xsl:template match="md:EntityDescriptor[not(md:Organization/md:OrganizationName)]">
<xsl:call-template name="error">
<xsl:with-param name="m">entity lacks OrganizationName</xsl:with-param>
</xsl:call-template>
</xsl:template>


<!--
Check for https:// locations that use an explicit but redundant port specifier.
-->
<xsl:template match="*[@Location and starts-with(@Location, 'https://')
and contains(@Location,':443/')]">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:value-of select='local-name()'/>
<xsl:text> Location </xsl:text>
<xsl:value-of select="@Location"/>
<xsl:text> not in standard form</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:template>


</xsl:stylesheet>
15 changes: 15 additions & 0 deletions mdx/uk/uk-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@
</constructor-arg>
</bean>

<!--
check_ukreg
Checks specific to the UK registrar function.
-->
<bean id="check_ukreg" class="net.shibboleth.metadata.dom.XSLValidationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="check_ukreg"/>
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/build/check_ukreg.xsl"/>
</bean>
</property>
</bean>

<!--
ukTrustRootsDocument
Expand Down
1 change: 1 addition & 0 deletions mdx/uk/uk-collect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<ref bean="populateUKIds"/>
<ref bean="checkSchemas"/>
<ref bean="CHECK.std"/>
<ref bean="check_ukreg"/>

<!-- failure of any check on registered metadata is fatal -->
<ref bean="errorTerminatingFilter"/>
Expand Down

0 comments on commit cbec910

Please sign in to comment.