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

Commit

Permalink
Add very basic but generic ruleset for mdattr (entity attributes) spe…
Browse files Browse the repository at this point in the history
…cification.
  • Loading branch information
iay committed Apr 29, 2014
1 parent 7b8936f commit 9d28a99
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
70 changes: 70 additions & 0 deletions mdx/_rules/check_mdattr.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
check_mdattr.xsl
Checking ruleset containing rules associated with the SAML V2.0 Metadata
Extension for Entity Attributes Version 1.0, see:
https://wiki.oasis-open.org/security/SAML2MetadataAttr
This ruleset reflects Committee Specification 01, 04-Aug-2009.
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"

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"/>

<!--
Section 2.3
The specification only defines the meaning of EntityAttributes within the Extensions of either
EntitiesDescriptor or EntityDescriptor.
-->
<xsl:template match="mdattr:EntityAttributes[not(parent::md:Extensions)]">
<xsl:call-template name="error">
<xsl:with-param name="m">EntityAttributes must only appear within an Extensions element</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="md:Extensions[mdattr:EntityAttributes]
[not(parent::md:EntityDescriptor)][not(parent::md:EntitiesDescriptor)]">
<xsl:call-template name="error">
<xsl:with-param name="m">EntityAttributes must only appear within Extensions of EntityDescriptor or EntitiesDescriptor</xsl:with-param>
</xsl:call-template>
</xsl:template>

<!--
Section 2.3 line 176.
Assertions not permitted in the context of an EntitiesDescriptor.
-->
<xsl:template match="md:EntitiesDescriptor/md:Extensions/mdattr:EntityAttributes/saml:Assertion">
<xsl:call-template name="error">
<xsl:with-param name="m">Assertion may not appear in the EntityAttributes for an EntitiesDescriptor</xsl:with-param>
</xsl:call-template>
</xsl:template>

<!--
Section 2.3 line 182.
EntityAttributes MUST NOT appear more than once within a given <md:Extensions> element.
-->
<xsl:template match="md:Extensions/mdattr:EntityAttributes[position()>1]">
<xsl:call-template name="error">
<xsl:with-param name="m">more than one EntityAttributes element in an Extensions element</xsl:with-param>
</xsl:call-template>
</xsl:template>

</xsl:stylesheet>
21 changes: 21 additions & 0 deletions mdx/validation-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,26 @@
</property>
</bean>

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

<!--
check_mdattr
-->
<bean id="check_mdattr" parent="XSLValidationStage"
p:id="check_mdattr">
<property name="XSLResource">
<bean parent="FileSystemResource">
<constructor-arg value="#{ systemProperties['rulesdir'] }/check_mdattr.xsl"/>
</bean>
</property>
</bean>

<!--
*************************************************
*** ***
Expand Down Expand Up @@ -760,6 +780,7 @@
<ref bean="check_idpdisc"/>
<ref bean="check_incmd"/>
<ref bean="check_init"/>
<ref bean="check_mdattr"/>
<ref bean="check_mdiop"/>
<ref bean="check_mdrpi"/>
<ref bean="check_mdui"/>
Expand Down

0 comments on commit 9d28a99

Please sign in to comment.