Skip to content

Commit

Permalink
Add basic MDRPI metadata to UK entities in the export aggregate.
Browse files Browse the repository at this point in the history
Give the export aggregate its own namespace normalisation so that the mdrpi prefix can be hoisted to the document element.
  • Loading branch information
iay committed Feb 1, 2012
1 parent 37b1701 commit 0aba1c3
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 12 deletions.
76 changes: 65 additions & 11 deletions mdx/uk/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,31 @@
</property>
</bean>


<!--
uk_stripExtensions
Strip those UK federation extensions which we never publish.
-->
<bean id="uk_stripExtensions" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_stripExtensions"/>
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/strip_extensions.xsl"/>
</bean>
</property>
</bean>


<!--
***********************************************
*** ***
*** N A M E S P A C E H A N D L I N G ***
*** ***
***********************************************
-->

<!--
uk_normaliseNamespaces
Expand All @@ -306,23 +330,53 @@
</property>
</bean>


<!--
uk_stripExtensions
*************************************************
*** ***
*** M D R P I S P E C I F I C A T I O N ***
*** ***
*************************************************
-->

<!--
uk_registrar
Strip those UK federation extensions which we never publish.
Unique ID for the registrar associated with this channel.
-->
<bean id="uk_stripExtensions" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_stripExtensions"/>
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/strip_extensions.xsl"/>
</bean>
<bean id="uk_registrar" class="java.lang.String">
<constructor-arg value="http://ukfederation.org.uk"/>
</bean>

<!--
uk_check_regauth
Any registrationAuthority already present on an entity in this
channel must match the known registration authority value.
-->
<bean id="uk_check_regauth" parent="check_regauth_parent">
<property name="id" value="uk_check_regauth"/>
<property name="transformParameters">
<map>
<entry key="expectedAuthority" value-ref="uk_registrar"/>
</map>
</property>
</bean>

<!--
uk_default_regauth
Provide a default registrationAuthority appropriate to
this channel.
-->
<bean id="uk_default_regauth" parent="default_regauth_parent">
<property name="id" value="uk_default_regauth"/>
<property name="transformParameters">
<map>
<entry key="defaultAuthority" value-ref="uk_registrar"/>
</map>
</property>
</bean>


<!--
*********************************************
*** ***
Expand Down
13 changes: 12 additions & 1 deletion mdx/uk/generate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@
*******************************************
-->

<bean id="uk_normaliseExport" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_normaliseExport"/>
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/uk/ns_norm_export.xsl"/>
</bean>
</property>
</bean>

<bean id="uk_finaliseExport" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true">
<property name="id" value="uk_finaliseExport"/>
Expand Down Expand Up @@ -330,12 +340,13 @@
<property name="id" value="uk_exportPipeline"/>
<property name="stages">
<list>
<ref bean="uk_default_regauth"/>
<ref bean="uk_stripExtensions"/>
<ref bean="stripKeyNames"/>
<ref bean="uk_assemble"/>
<ref bean="removeEmptyExtensions"/>
<ref bean="uk_finaliseExport"/>
<ref bean="uk_normaliseNamespaces"/>
<ref bean="uk_normaliseExport"/>

<!-- schema validity check MUST pass -->
<ref bean="checkSchemas"/>
Expand Down
117 changes: 117 additions & 0 deletions mdx/uk/ns_norm_export.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
ns_norm_export.xsl
Normalise the namespaces in a metadata file for export.
The main constraint on the output of this transform is that it should minimise the size
of the output file while not having "too many" namespace prefix definitions in scope
at any point in the document. "Too many" is more than about ten, as a result of a bug
in the metadatatool application used by Shibboleth 1.3 IdPs to download and verify
metadata.
The strategy is to define the most commonly-used prefixes in the document element.
Prefixes which are less often used, but which may be used by container elements
(e.g., mdui:) or for attributes are normalised to use a prefix, but not declared
on the document element.
Prefixes which are less often used and are only used for non-containers can be
normalised to non-prefix use (i.e., to redefine the default namespace) if required
to cut the numbers down.
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0"
xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:elab="http://eduserv.org.uk/labels"
xmlns:idpdisc="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol"
xmlns:init="urn:oasis:names:tc:SAML:profiles:SSO:request-init"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"
xmlns:ukfedlabel="http://ukfederation.org.uk/2006/11/label"
xmlns:wayf="http://sdss.ac.uk/2006/06/WAYF"

exclude-result-prefixes="alg md mdattr elab saml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata">


<!--
Import templates for basic normalisation.
-->
<xsl:import href="../../build/ns_norm.xsl"/>


<!--
Force UTF-8 encoding for the output.
-->
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8"/>


<!--
*******************************************
*** ***
*** D O C U M E N T E L E M E N T ***
*** ***
*******************************************
-->


<!--
We need to handle the document element specially in order to arrange
for all appropriate namespace prefix definitions to appear on it.
There are only two possible document elements in SAML metadata.
-->


<!--
Document element is <EntityDescriptor>.
-->
<xsl:template match="/md:EntityDescriptor">
<EntityDescriptor>
<xsl:apply-templates select="node()|@*"/>
</EntityDescriptor>
</xsl:template>

<!--
Document element is <EntitiesDescriptor>.
-->
<xsl:template match="/md:EntitiesDescriptor">
<EntitiesDescriptor>
<xsl:apply-templates select="node()|@*"/>
</EntitiesDescriptor>
</xsl:template>


<!--
*************************************
*** ***
*** A L G N A M E S P A C E ***
*** ***
*************************************
-->


<!--
alg:*
Normalise namespace to not use a prefix.
-->
<xsl:template match="alg:*">
<xsl:element name="{local-name()}" namespace="urn:oasis:names:tc:SAML:metadata:algsupport">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>


</xsl:stylesheet>

0 comments on commit 0aba1c3

Please sign in to comment.