Skip to content

Commit

Permalink
Move the collection of pushed scopes into the members API bean.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Jun 14, 2011
1 parent dd875a7 commit a629b6e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 42 deletions.
18 changes: 10 additions & 8 deletions build/master_ukfederation.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@
xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0"
xmlns:ukfedlabel="http://ukfederation.org.uk/2006/11/label"

xmlns:ukfxMembers="xalan://uk.org.ukfederation.members.Members"
extension-element-prefixes="ukfxMembers"

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

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

<!--
Pick up "members" document and extract outsourced scope lists from it.
Pick up "members" document and build an API bean from it.
-->
<xsl:variable name="memberDocument" select="document('../xml/members.xml')"/>
<xsl:variable name="outsourcedScopes"
select="$memberDocument//members:Member/members:Scopes[members:Entity]"/>

<xsl:variable name="members" select="ukfxMembers:new($memberDocument)"/>

<!--
Root EntitiesDescriptor element.
Expand All @@ -58,7 +60,7 @@
<xsl:apply-templates select="node()"/>
<!-- copy scopes from member outsource records -->
<xsl:variable name="entityID" select="ancestor::md:EntityDescriptor/@entityID"/>
<xsl:for-each select="$outsourcedScopes[members:Entity = $entityID]/members:Scope">
<xsl:for-each select="ukfxMembers:scopesForEntity($members, $entityID)/shibmeta:Scope">
<xsl:text> </xsl:text>
<xsl:element name="shibmeta:Scope">
<xsl:attribute name="regexp">false</xsl:attribute>
Expand Down Expand Up @@ -87,7 +89,7 @@
<xsl:copy-of select="."/>
</xsl:for-each>
<!-- copy scopes from member outsource records -->
<xsl:for-each select="$outsourcedScopes[members:Entity = $entityID]/members:Scope">
<xsl:for-each select="ukfxMembers:scopesForEntity($members, $entityID)/shibmeta:Scope">
<xsl:text>&#10; </xsl:text>
<xsl:element name="shibmeta:Scope">
<xsl:attribute name="regexp">false</xsl:attribute>
Expand Down Expand Up @@ -120,7 +122,7 @@
<xsl:text>&#10; </xsl:text>
</xsl:for-each>
<!-- copy scopes from member outsource records -->
<xsl:for-each select="$outsourcedScopes[members:Entity = $entityID]/members:Scope">
<xsl:for-each select="ukfxMembers:scopesForEntity($members, $entityID)/shibmeta:Scope">
<xsl:text> </xsl:text>
<xsl:element name="shibmeta:Scope">
<xsl:attribute name="regexp">false</xsl:attribute>
Expand Down
17 changes: 2 additions & 15 deletions mdx/uk/collect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</property>
<property name="transformParameters">
<map>
<entry key="membersDocument" value-ref="membersDocument"/>
<entry key="members" value-ref="members"/>
</map>
</property>
</bean>
Expand All @@ -96,6 +96,7 @@
<ref bean="fetchUkFragmentFiles"/>
<ref bean="filterDeletedEntities"/>
<ref bean="processFragment"/>
<ref bean="processScopes"/>
<ref bean="populateItemIds"/>
<ref bean="populateUKIds"/>
<ref bean="checkSchemas"/>
Expand All @@ -107,25 +108,11 @@

<ref bean="assemble.uk"/>

<!--
Process scopes on the entities. Because the transform performs
a fairly heavyweight extraction operation on the members document
before applying the results, this is best done on the resulting
aggregate so that the extraction happens only once.
A better long-term alternative would be to build support for
this on a per-entity or per-owner basis into the Members bean.
-->
<ref bean="processScopes"/>

<!--
Add the federation trust roots.
-->
<ref bean="addUKTrustRoots"/>

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

<ref bean="normaliseNamespaces"/>
</list>
</property>
Expand Down
39 changes: 20 additions & 19 deletions mdx/uk/scopes.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
<xsl:stylesheet version="1.0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:members="http://ukfederation.org.uk/2007/01/members"
xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0"
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"

xmlns:ukfxMembers="xalan://uk.org.ukfederation.members.Members"
extension-element-prefixes="ukfxMembers"

xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -20,12 +23,10 @@
<!--Force UTF-8 encoding for the output.-->
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8" indent="yes"/>

<!--
The "members" document is passed in as a parmeter; extract outsourced scope lists from it.
-->
<xsl:param name="membersDocument"/>
<xsl:variable name="outsourcedScopes"
select="$membersDocument//members:Member/members:Scopes[members:Entity]"/>
<!--
Parameters.
-->
<xsl:param name="members"/>

<!--
Extend the scope list contained within an IdP's entity-level Extensions element
Expand All @@ -37,9 +38,9 @@
<xsl:apply-templates select="node()"/>
<!-- copy scopes from member outsource records -->
<xsl:variable name="entityID" select="ancestor::md:EntityDescriptor/@entityID"/>
<xsl:for-each select="$outsourcedScopes[members:Entity = $entityID]/members:Scope">
<xsl:text> </xsl:text>
<xsl:element name="shibmeta:Scope">
<xsl:for-each select="ukfxMembers:scopesForEntity($members, $entityID)/shibmd:Scope">
<xsl:text> </xsl:text>
<xsl:element name="shibmd:Scope">
<xsl:attribute name="regexp">false</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
Expand All @@ -61,14 +62,14 @@
<xsl:text>&#10; </xsl:text>
<xsl:element name="Extensions" namespace="urn:oasis:names:tc:SAML:2.0:metadata">
<!-- copy scopes from EntityDescriptor extensions -->
<xsl:for-each select="ancestor::md:EntityDescriptor/md:Extensions/shibmeta:Scope">
<xsl:for-each select="ancestor::md:EntityDescriptor/md:Extensions/shibmd:Scope">
<xsl:text>&#10; </xsl:text>
<xsl:copy-of select="."/>
</xsl:for-each>
<!-- copy scopes from member outsource records -->
<xsl:for-each select="$outsourcedScopes[members:Entity = $entityID]/members:Scope">
<xsl:text>&#10; </xsl:text>
<xsl:element name="shibmeta:Scope">
<xsl:for-each select="ukfxMembers:scopesForEntity($members, $entityID)/shibmd:Scope">
<xsl:text>&#10; </xsl:text>
<xsl:element name="shibmd:Scope">
<xsl:attribute name="regexp">false</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
Expand All @@ -91,17 +92,17 @@
<xsl:copy>
<xsl:variable name="entityID" select="ancestor::md:EntityDescriptor/@entityID"/>
<xsl:apply-templates select="node()"/>
<xsl:if test="not(shibmeta:Scope)">
<xsl:if test="not(shibmd:Scope)">
<!-- copy scopes from EntityDescriptor extensions -->
<xsl:for-each select="ancestor::md:EntityDescriptor/md:Extensions/shibmeta:Scope">
<xsl:for-each select="ancestor::md:EntityDescriptor/md:Extensions/shibmd:Scope">
<xsl:text> </xsl:text>
<xsl:copy-of select="."/>
<xsl:text>&#10; </xsl:text>
</xsl:for-each>
<!-- copy scopes from member outsource records -->
<xsl:for-each select="$outsourcedScopes[members:Entity = $entityID]/members:Scope">
<xsl:text> </xsl:text>
<xsl:element name="shibmeta:Scope">
<xsl:for-each select="ukfxMembers:scopesForEntity($members, $entityID)/shibmd:Scope">
<xsl:text> </xsl:text>
<xsl:element name="shibmd:Scope">
<xsl:attribute name="regexp">false</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
Expand Down
Binary file not shown.

0 comments on commit a629b6e

Please sign in to comment.