Skip to content

Commit

Permalink
Bugzilla 895: add mdrpi metadata to Edugate import.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Feb 1, 2012
1 parent d8b5763 commit 37b1701
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mdx/common-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,31 @@
</property>
</bean>

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

<!--
default_regauth_parent
Parent (template) for per-channel beans.
Any registrationAuthority already present on an entity in this
channel must match the known registration authority value.
-->
<bean id="default_regauth_parent" class="net.shibboleth.metadata.dom.XSLTransformationStage"
init-method="initialize" lazy-init="true" abstract="true">
<property name="xslResource">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/mdx/default_regauth.xsl"/>
</bean>
</property>
</bean>

<!--
*********************
*** ***
Expand Down
77 changes: 77 additions & 0 deletions mdx/default_regauth.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
default_regauth.xsl
Apply a default registrationAuthority to entities which don't have one already.
-->
<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:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata">

<!--
defaultAuthority
Set this parameter from the calling context.
-->
<xsl:param name="defaultAuthority">(value not set)</xsl:param>

<!--
EntityDescriptor with no Extensions doesn't have a RegistrationInfo,
by definition.
-->
<xsl:template match="md:EntityDescriptor[not(md:Extensions)]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:text>&#10;</xsl:text>
<xsl:text> </xsl:text>
<xsl:element name="Extensions" namespace="urn:oasis:names:tc:SAML:2.0:metadata">
<xsl:call-template name="default_regauth"/>
</xsl:element>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!--
EntityDescriptor with Extensions but without RegistrationInfo needs to have one
injected into the existing Extensions.
-->
<xsl:template match="md:EntityDescriptor/md:Extensions[not(mdrpi:RegistrationInfo)]">
<xsl:copy>
<xsl:call-template name="default_regauth"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!--
Default RegistrationInfo element, with associated white space.
-->
<xsl:template name="default_regauth">
<xsl:text>&#10;</xsl:text>
<xsl:text> </xsl:text>
<xsl:element name="mdrpi:RegistrationInfo">
<xsl:attribute name="registrationAuthority">
<xsl:value-of select="$defaultAuthority"/>
</xsl:attribute>
</xsl:element>
<xsl:text>&#10;</xsl:text>
<xsl:text> </xsl:text>
</xsl:template>

<!--By default, copy text blocks, comments and attributes unchanged.-->
<xsl:template match="text()|comment()|@*">
<xsl:copy/>
</xsl:template>

<!--By default, copy all elements from the input to the output, along with their attributes and contents.-->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
16 changes: 16 additions & 0 deletions mdx/ie_edugate/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@
</property>
</bean>

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

<!--
Fetch and process all entities as a collection.
-->
Expand Down Expand Up @@ -147,6 +162,7 @@

<ref bean="disassemble"/>

<ref bean="ie_edugate_default_regauth"/>
<ref bean="ie_edugate_check_regauth"/>
<ref bean="standardImportActions"/>
</list>
Expand Down

0 comments on commit 37b1701

Please sign in to comment.