Skip to content

Commit

Permalink
Add proof-of-concept discovery feed generation
Browse files Browse the repository at this point in the history
See ukf/ukf-meta#230.
  • Loading branch information
iay committed Jun 4, 2020
1 parent af68a77 commit af6ab08
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,11 @@
-->
<CHANNEL.do channel="uk" verb="generate"/>

<!--
Generate discovery feeds.
-->
<CHANNEL.do channel="uk" verb="discofeeds"/>

<!--
Post-process mda-generated output files.
-->
Expand Down
138 changes: 138 additions & 0 deletions mdx/uk/discofeeds.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Verb to generate EDS-format JSON discovery feeds corresponding to
the (previously generated) unsigned production aggregate.
Two such feeds are generated:
* discofeed-all.json includes all IdPs in the production aggregate.
* discofeed.json includes only those IdPs not marked as hidden.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
default-lazy-init="true"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
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.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<!--
Import commonly used beans.
-->
<import resource="classpath:common-beans.xml"/>

<!--
Import channel-specific beans.
-->
<import resource="classpath:uk/beans.xml"/>

<!--
*****************************
*** ***
*** U T I L I T I E S ***
*** ***
*****************************
-->

<!-- This bean MUST be called "conversionService" to work properly. -->
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="net.shibboleth.ext.spring.config.DurationToLongConverter" />
<bean class="net.shibboleth.ext.spring.config.StringToIPRangeConverter" />
<bean class="net.shibboleth.ext.spring.config.BooleanToPredicateConverter" />
<bean class="net.shibboleth.ext.spring.config.StringBooleanToPredicateConverter" />
<bean class="net.shibboleth.ext.spring.config.StringToResourceConverter" />
</set>
</property>
</bean>


<!--
***************************************************
*** ***
*** P R O D U C T I O N A G G R E G A T E ***
*** ***
***************************************************
-->

<bean id="serializeUnsignedProductionAggregate" parent="mda.SerializationStage">
<property name="serializer" ref="serializer"/>
<property name="outputFile">
<bean parent="File">
<constructor-arg value="${output.dir}/ukfederation-metadata-unsigned.xml"/>
</bean>
</property>
</bean>


<!--
*************************************
*** ***
*** M A I N P I P E L I N E ***
*** ***
*************************************
-->

<bean id="discoFeedSerializer" parent="ukf.DiscoFeedCollectionSerializer"
p:prettyPrinting="true"/>

<bean id="discofeeds" parent="mda.SimplePipeline">
<property name="stages">
<list>
<!--
Acquire the production aggregate and split it into
individual entities.
-->
<bean id="productionAggregate" parent="mda.DOMResourceSourceStage"
p:parserPool-ref="parserPool">
<property name="DOMResource">
<bean parent="FileSystemResource">
<constructor-arg value="${output.dir}/ukfederation-metadata-unsigned.xml"/>
</bean>
</property>
</bean>
<ref bean="disassemble"/>

<!--
Serialize all IdPs in the collection into a feed.
-->
<bean id="discoFeedAll" parent="mda.SerializationStage"
p:serializer-ref="discoFeedSerializer">
<property name="outputFile">
<bean parent="File">
<constructor-arg value="${output.dir}/discofeed-all.json"/>
</bean>
</property>
</bean>

<!--
Remove all "hidden from discovery" IdPs.
-->
<bean id="removeHidden" parent="mda.XPathFilteringStage"
p:namespaceContext-ref="commonNamespaces"
p:XPathExpression="//mdattr:EntityAttributes/saml:Attribute
[@Name = 'http://macedir.org/entity-category']
[@NameFormat = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri']
[saml:AttributeValue[.='http://refeds.org/category/hide-from-discovery']]"/>

<!--
Serialize all IdPs that remain into a second feed.
-->
<bean id="discoFeed" parent="mda.SerializationStage"
p:serializer-ref="discoFeedSerializer">
<property name="outputFile">
<bean parent="File">
<constructor-arg value="${output.dir}/discofeed.json"/>
</bean>
</property>
</bean>

</list>
</property>
</bean>

</beans>

0 comments on commit af6ab08

Please sign in to comment.