Skip to content

Commit

Permalink
Extract common beans into a shared Spring configuration file. Restore…
Browse files Browse the repository at this point in the history
…d the original alphabetical ordering of schema files now that the SchemaBuilder isn't confused by dependencies.
  • Loading branch information
iay committed Apr 8, 2011
1 parent 22c95ab commit 06cba5e
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 114 deletions.
125 changes: 125 additions & 0 deletions feds/common_beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Common bean definitions.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!--
parserPool
A pre-configured parser pool for use by source stages.
-->
<bean id="parserPool" class="org.opensaml.util.xml.BasicParserPool" init-method="initialize">
<property name="ignoreComments" value="false"/>
<property name="ignoreElementContentWhitespace" value="false"/>
</bean>

<!--
commonNamespaces
A map that assigns the usual prefix for each of the commonly used XML namespaces.
This is used in the evaluation of XPath expressions.
-->
<util:map id="commonNamespaces" map-class="java.util.HashMap">
<entry key="ds" value="http://www.w3.org/2000/09/xmldsig#"/>
<entry key="elab" value="http://eduserv.org.uk/labels"/>
<entry key="idpdisc" value="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol"/>
<entry key="init" value="urn:oasis:names:tc:SAML:profiles:SSO:request-init"/>
<entry key="md" value="urn:oasis:names:tc:SAML:2.0:metadata"/>
<entry key="mdrpi" value="urn:oasis:names:tc:SAML:metadata:rpi"/>
<entry key="mdui" value="urn:oasis:names:tc:SAML:metadata:ui"/>
<entry key="saml" value="urn:oasis:names:tc:SAML:2.0:assertion"/>
<entry key="shibmd" value="urn:mace:shibboleth:metadata:1.0"/>
<entry key="ukfedlabel" value="http://ukfederation.org.uk/2006/11/label"/>
<entry key="wayf" value="http://sdss.ac.uk/2006/06/WAYF"/>
<entry key="xenc" value="http://www.w3.org/2001/04/xmlenc#"/>
<entry key="xsi" value="http://www.w3.org/2001/XMLSchema-instance"/>
<entry key="xsl" value="http://www.w3.org/1999/XSL/Transform"/>
</util:map>

<!--
schemaResources
A list of all schema documents that we make common use of.
-->
<util:list id="schemaResources">
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/saml-metadata-rpi-v1.0-wd05.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/saml-schema-assertion-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/saml-schema-metadata-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/shibboleth-metadata-1.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-metadata-attr.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-request-initiation.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-idp-discovery.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-metadata-algsupport-v1.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-metadata-ui-v1.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-schema-assertion-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-schema-metadata-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/uk-fed-label.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/ukfederation-members.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/xenc-schema.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/xml.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/xmldsig-core-schema.xsd"/>
</bean>
</util:list>

<!--
checkSchemas
A pipeline stage that checks against all the common schemas, as above, and then announces
and filters any errors encountered.
-->
<bean id="checkSchemas" class="net.shibboleth.metadata.dom.stage.XMLSchemaValidationStage">
<property name="id" value="checkSchemas"/>
<property name="schemaResources" ref="schemaResources"/>
<property name="postProcessFilter">
<bean class="uk.org.ukfederation.mda.ErrorAnnouncingFilteringStrategy"/>
</property>
</bean>

<!--
<bean id="members" class="uk.org.ukfederation.members.Members">
<constructor-arg>
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/members.xml"/>
</bean>
</constructor-arg>
</bean>
-->

</beans>
79 changes: 7 additions & 72 deletions feds/edugain/import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!--
Import commonly used beans.
-->
<import resource="../common_beans.xml"/>

<bean id="fetchEduGainExportAggregate" class="net.shibboleth.metadata.dom.stage.DomHttpSourceStage">
<property name="id" value="fetchEduGainExportAggregate"/>
<property name="parserPool">
<bean class="org.opensaml.util.xml.BasicParserPool" init-method="initialize">
<property name="ignoreComments" value="false"/>
</bean>
</property>
<property name="parserPool" ref="parserPool"/>
<property name="sourceUrl" value="http://mds.edugain.org"/>
</bean>

Expand All @@ -42,72 +43,6 @@
<property name="id" value="disassemble"/>
</bean>

<util:list id="schemaResources">
<bean class="org.opensaml.util.resource.FilesystemResource">
<!-- no dependencies -->
<constructor-arg value="#{ systemProperties['basedir'] }/xml/xml.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<!-- no dependencies -->
<constructor-arg value="#{ systemProperties['basedir'] }/xml/xmldsig-core-schema.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<!-- dependency on xmldsig-core-schema -->
<constructor-arg value="#{ systemProperties['basedir'] }/xml/xenc-schema.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<!-- dependencies on xmldsig-core-schema, xenc-schema -->
<constructor-arg value="#{ systemProperties['basedir'] }/xml/saml-schema-assertion-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<!-- dependencies on xmldsig-core-schema, xenc-schema, saml-schema-assertion-2.0, xml -->
<constructor-arg value="#{ systemProperties['basedir'] }/xml/saml-schema-metadata-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<!-- dependencies on xml, saml-schema-metadata-2.0 -->
<constructor-arg value="#{ systemProperties['basedir'] }/xml/saml-metadata-rpi-v1.0-wd05.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/shibboleth-metadata-1.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-metadata-attr.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-request-initiation.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-idp-discovery.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-metadata-algsupport-v1.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-metadata-ui-v1.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/uk-fed-label.xsd"/>
</bean>
<!--
These appear to be redundant duplicates...
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-schema-assertion-2.0.xsd"/>
</bean>
<bean class="org.opensaml.util.resource.FilesystemResource">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/sstc-saml-schema-metadata-2.0.xsd"/>
</bean>
-->
</util:list>

<bean id="checkSchemas" class="net.shibboleth.metadata.dom.stage.XMLSchemaValidationStage">
<property name="id" value="checkSchemas"/>
<property name="schemaResources" ref="schemaResources"/>
<property name="postProcessFilter">
<bean class="uk.org.ukfederation.mda.ErrorAnnouncingFilteringStrategy"/>
</property>
</bean>

<bean id="assemble" class="net.shibboleth.metadata.dom.saml.EntitiesDescriptorAssemblerStage">
<property name="id" value="assemble"/>
</bean>
Expand All @@ -125,6 +60,6 @@
</property>
</bean>

<bean id="serializer" class="net.shibboleth.metadata.dom.DomMetadataSerializer" />
<bean id="serializer" class="net.shibboleth.metadata.dom.DomMetadataSerializer"/>

</beans>
20 changes: 12 additions & 8 deletions feds/edugate/import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<!--
Import commonly used beans.
-->
<import resource="../common_beans.xml"/>

<!--
Fetch the Edugate metadata aggregate. For the moment, use the production aggregate in lieu
of a designated export aggregate.
-->
<bean id="fetchEdugateExportAggregate" class="net.shibboleth.metadata.dom.stage.DomHttpSourceStage">
<property name="id" value="fetchEdugateExportAggregate"/>
<property name="parserPool">
<bean class="org.opensaml.util.xml.BasicParserPool" init-method="initialize">
<property name="ignoreComments" value="false"/>
<property name="ignoreElementContentWhitespace" value="false"/>
</bean>
</property>
<property name="parserPool" ref="parserPool"/>
<property name="sourceUrl" value="https://edugate.heanet.ie/edugate-metadata-signed.xml"/>
</bean>

Expand All @@ -26,14 +26,17 @@
<bean id="edugateSigningCertificate" class="net.shibboleth.ext.spring.factory.X509CertificateFactoryBean">
<property name="certificateFile">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/feds/edugate/edugate-signer.crt"/>
<constructor-arg value="#{ systemProperties['basedir'] }/feds/edugate/metadata-signer.crt"/>
</bean>
</property>
</bean>

<bean id="checkEdugateSignature" class="net.shibboleth.metadata.dom.stage.XMLSignatureValidationStage">
<property name="id" value="checkEdugateSignature"/>
<property name="verificationCertificate" ref="edugateSigningCertificate"/>
<property name="postProcessFilter">
<bean class="uk.org.ukfederation.mda.ErrorAnnouncingFilteringStrategy"/>
</property>
</bean>

<bean id="disassemble" class="net.shibboleth.metadata.dom.saml.EntitiesDescriptorDisassemblerStage">
Expand All @@ -51,11 +54,12 @@
<ref bean="fetchEdugateExportAggregate"/>
<ref bean="checkEdugateSignature"/>
<ref bean="disassemble"/>
<ref bean="checkSchemas"/>
<ref bean="assemble"/>
</list>
</property>
</bean>

<bean id="serializer" class="net.shibboleth.metadata.dom.DomMetadataSerializer" />
<bean id="serializer" class="net.shibboleth.metadata.dom.DomMetadataSerializer"/>

</beans>
42 changes: 8 additions & 34 deletions feds/uk/collect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,19 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<util:map id="commonNamespaces" map-class="java.util.HashMap">
<entry key="ds" value="http://www.w3.org/2000/09/xmldsig#"/>
<entry key="elab" value="http://eduserv.org.uk/labels"/>
<entry key="idpdisc" value="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol"/>
<entry key="init" value="urn:oasis:names:tc:SAML:profiles:SSO:request-init"/>
<entry key="md" value="urn:oasis:names:tc:SAML:2.0:metadata"/>
<entry key="mdrpi" value="urn:oasis:names:tc:SAML:metadata:rpi"/>
<entry key="mdui" value="urn:oasis:names:tc:SAML:metadata:ui"/>
<entry key="saml" value="urn:oasis:names:tc:SAML:2.0:assertion"/>
<entry key="shibmd" value="urn:mace:shibboleth:metadata:1.0"/>
<entry key="ukfedlabel" value="http://ukfederation.org.uk/2006/11/label"/>
<entry key="wayf" value="http://sdss.ac.uk/2006/06/WAYF"/>
<entry key="xenc" value="http://www.w3.org/2001/04/xmlenc#"/>
<entry key="xsi" value="http://www.w3.org/2001/XMLSchema-instance"/>
<entry key="xsl" value="http://www.w3.org/1999/XSL/Transform"/>
</util:map>

<!--
Import commonly used beans.
-->
<import resource="../common_beans.xml"/>

<bean id="filterDeletedEntities" class="uk.org.ukfederation.mda.XPathFilteringStrategy">
<constructor-arg name="expression" value="//ukfedlabel:DeletedEntity"/>
<constructor-arg name="prefixMappings" ref="commonNamespaces"/>
</bean>

<bean id="fetchUkFragmentFiles" class="net.shibboleth.metadata.dom.stage.DomFilesystemSourceStage">
<property name="id" value="fetchUkFragmentFiles"/>
<property name="parserPool">
<bean class="org.opensaml.util.xml.BasicParserPool" init-method="initialize">
<property name="ignoreComments" value="false"/>
<property name="ignoreElementContentWhitespace" value="false"/>
</bean>
</property>
<property name="parserPool" ref="parserPool"/>
<property name="source">
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/entities"/>
Expand All @@ -52,16 +35,6 @@
<property name="postProcessFilter" ref="filterDeletedEntities"/>
</bean>

<!--
<bean id="members" class="uk.org.ukfederation.members.Members">
<constructor-arg>
<bean class="java.io.File">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/members.xml"/>
</bean>
</constructor-arg>
</bean>
-->

<bean id="assemble" class="net.shibboleth.metadata.dom.saml.EntitiesDescriptorAssemblerStage">
<property name="id" value="assemble"/>
</bean>
Expand All @@ -71,11 +44,12 @@
<property name="stages">
<list>
<ref bean="fetchUkFragmentFiles"/>
<ref bean="checkSchemas"/>
<ref bean="assemble"/>
</list>
</property>
</bean>

<bean id="serializer" class="net.shibboleth.metadata.dom.DomMetadataSerializer" />
<bean id="serializer" class="net.shibboleth.metadata.dom.DomMetadataSerializer"/>

</beans>

0 comments on commit 06cba5e

Please sign in to comment.