Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Support incmd (InCommon Federation metadata) extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed May 3, 2013
1 parent 922e0c8 commit e9225d1
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 2 deletions.
97 changes: 97 additions & 0 deletions mdx/_rules/check_incmd.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
check_incmd.xsl
Checking ruleset for the InCommon Federation metadata extensions,
the schema for which can be found here:
https://spaces.internet2.edu/x/iIuVAQ
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0"
xmlns:incmd="http://id.incommon.org/metadata"
xmlns:md="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"

xmlns="urn:oasis:names:tc:SAML:2.0:metadata">

<!--
Common support functions.
-->
<xsl:import href="check_framework.xsl"/>

<!--
Checks for the contactType attribute.
-->

<xsl:template match="@incmd:contactType[not(parent::md:ContactPerson)]">
<xsl:call-template name="error">
<xsl:with-param name="m">incmd:contactType should only appear on md:ContactPerson</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template match="md:ContactPerson[@incmd:contactType][@contactType != 'other']">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>incmd:contactType requires contactType='other', found '</xsl:text>
<xsl:value-of select="@contactType"/>
<xsl:text>'</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template match="@incmd:contactType[not(starts-with(.,'http://'))][not(starts-with(.,'https://'))]">
<xsl:call-template name="error">
<xsl:with-param name="m">incmd:contactType must be an absolute URI</xsl:with-param>
</xsl:call-template>
</xsl:template>

<!--
Check for specific values. This test is probably over-specific in the long term.
-->
<xsl:template match="@incmd:contactType
[not(. = 'http://id.incommon.org/metadata/contactType/security')]">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>unknown value '</xsl:text>
<xsl:value-of select="."/>
<xsl:text>' for incmd:contactType</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template match="@incmd:contactType">
<!-- otherwise, fine -->
</xsl:template>

<!--
Additional schema checks.
The schema itself doesn't help very much as most contexts in which the incmd
namespace is used are subject to "lax" checking. These checks duplicate some
aspects of XML Schema checking as we'd like it to behave.
-->

<xsl:template match="incmd:*">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>unknown element incmd:</xsl:text>
<xsl:value-of select="local-name()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template match="@incmd:*">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>unknown attribute incmd:</xsl:text>
<xsl:value-of select="local-name()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

</xsl:stylesheet>
5 changes: 3 additions & 2 deletions mdx/common-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
<bean id="component_parent" abstract="true" init-method="initialize"/>

<!--
file_parent
FilesystemResource / file_parent
Parent for all file system resource beans.
-->
<bean id="file_parent" abstract="true" parent="component_parent"
<bean id="FilesystemResource" name="file_parent" abstract="true" parent="component_parent"
class="net.shibboleth.utilities.java.support.resource.FilesystemResource"/>

<!--
Expand Down Expand Up @@ -437,6 +437,7 @@
A list of all schema documents that we make common use of.
-->
<util:list id="schemaResources">
<bean parent="FilesystemResource" c:resourcePath="#{ systemProperties['basedir'] }/xml/incommon-metadata.xsd"/>
<bean parent="file_parent">
<constructor-arg value="#{ systemProperties['basedir'] }/xml/MetadataExchange.xsd"/>
</bean>
Expand Down
19 changes: 19 additions & 0 deletions mdx/validation-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,24 @@
</property>
</bean>

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

<!--
check_incmd
-->
<bean id="check_incmd" parent="check_xslt_parent"
p:id="check_incmd">
<property name="xslResource">
<bean parent="FilesystemResource" c:resourcePath="#{ systemProperties['rulesdir'] }/check_incmd.xsl"/>
</property>
</bean>

<!--
*******************************************************************
*** ***
Expand Down Expand Up @@ -616,6 +634,7 @@
<ref bean="check_bindings"/>
<ref bean="check_hoksso"/>
<ref bean="check_idpdisc"/>
<ref bean="check_incmd"/>
<ref bean="check_init"/>
<ref bean="check_mdiop"/>
<ref bean="check_mdrpi"/>
Expand Down
28 changes: 28 additions & 0 deletions xml/incommon-metadata.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://id.incommon.org/metadata"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
blockDefault="substitution"
version="2.0">

<xs:annotation>
<xs:documentation>
Document title: Schema for InCommon Federation metadata extensions
Document identifier: Metadata Extension Schema
Location: https://spaces.internet2.edu/x/iIuVAQ
Revision history:
V1.2 (3 May 2013):
Make schema itself schema-valid.
V1.1 (2 May 2013):
Initial version. Added documentation.
V1.0 (2 December 2011):
Initial version. Added contactType attribute.
</xs:documentation>
</xs:annotation>

<xs:attribute name="contactType" type="xs:anyURI"/>

</xs:schema>

0 comments on commit e9225d1

Please sign in to comment.