Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This command line configuration example:

  • reads a file directory of files at path/to/metadata.xml/input/entities/ containing SAML metadata files representing individual entities

  • removes any person or organization contact information

  • wraps the results in an EntitiesDescriptor

  • signs the document using a private key taken from the file path/to//input/private-key.pem

  • writes the results into the file path/to/output/signed-aggregate.xml

You can execute the example as follows:

Code Block
languagebash
$ .../mda.sh configaggregate-and-sign.xml main

The example configuration file is as follows; it has been verified with MDA version 0.9.110.0-SNAPSHOT as of 2023-10-20:

Code Block
languagexml
<?xml version="1.0" encoding="UTF-8"?>
<beans default-init-method="initialize"
       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 the Standard bean definition resource. -->
    <!-- See https://shibboleth.atlassian.net/wiki/spaces/MA1/pages/3162439683/Standard+bean+definition+resource -->
    <import resource="classpath:net/shibboleth/metadata/beans.xml"/>

    <!-- First, we define the stages for our pipeline. -->

    <!-- Import each XML document in the given directory as a separate item for processing. -->
    <bean id="source" classparent="net.shibboleth.metadata.dommda.DOMFilesystemSourceStage">
        <property name="id" value="source"/>
        <property name="parserPool">
            <bean class="net.shibboleth.utilitiesshared.javaxml.supportimpl.xml.BasicParserPool" init-method="initialize"/>
        </property>
        <property name="source">
            <bean class="java.io.File">
                <constructor-arg value="path/to/metadata.xmlinput/entities"/>
            </bean>
        </property>
    </bean>

    <bean id="removeInvalidContactPerson" classparent="net.shibboleth.metadata.dom.saml.mda.ContactPersonFilterStage">
        <property name="id" value="removeInvalidContactPerson"/>
        <property name="whitelistingTypes" value="false"/>
    </bean>

    <bean id="removeOrganization" classparent="net.shibboleth.metadata.dom.saml.mda.RemoveOrganizationStage">
        <property name="id" value="removeOrganization"/>
    </bean>

    <bean id="createEntitiesDescriptor" classparent="net.shibboleth.metadata.dom.saml.mda.EntitiesDescriptorAssemblerStage">
        <property name="id" value="createEntitiesDescriptor"/>
    </bean>

    <bean id="generateContentReferenceId" classparent="net.shibboleth.metadata.dom.samlmda.GenerateIdStage">
        <property name="id" value="generateContentReferenceId" />
    </bean>

    <bean id="signMetadata" classparent="net.shibboleth.metadata.dom.mda.XMLSignatureSigningStage">
        <property name="id" value="signMetadata"/>
        <property name="privateKey">
            <bean class="net.shibboleth.extshared.spring.security.factory.PrivateKeyFactoryBean">
                <property name="resource">
                    <bean class="org.springframework.core.io.FileSystemResource">
                        <constructor-arg>
                            <bean class="java.io.File">
                                <constructor-arg value="path/to/private-key.pem"/>
                            </bean>
                        </constructor-arg>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>

    <bean id="serialize" classparent="net.shibboleth.metadata.pipeline.mda.SerializationStage">
        <property name="id" value="serializeIdPs"/>
        <property name="outputFile">
            <bean class="java.io.File">
                <constructor-arg value="path/to/output/aggregate-signed.xml"/>
            </bean>
        </property>
        <property name="serializer">
            <bean id="domSerializer" classparent="net.shibboleth.metadata.dom.mda.DOMElementSerializer" />
        </property>
    </bean>

    <!-- Next we define a pipeline with all the stages in it -->
    <bean id="main" classparent="net.shibboleth.metadata.pipeline.mda.SimplePipeline" init-method="initialize">
        <property name="id" value="main"/>
        <property name="stages">
            <list>
                <ref bean="source"/>
                <ref bean="removeInvalidContactPerson"/>
                <ref bean="removeOrganization"/>
                <ref bean="createEntitiesDescriptor"/>
                <ref bean="generateContentReferenceId" />
                <ref bean="signMetadata"/>
                <ref bean="serialize" />
            </list>
        </property>
    </bean>
</beans>