-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial work on a framework for pattern-based checking of metadata.
- Loading branch information
Showing
2 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| check.xsl | ||
| XSL stylesheet that takes a file full of metadata for the UK federation | ||
| and checks it against local conventions. | ||
| Author: Ian A. Young <ian@iay.org.uk> | ||
| --> | ||
| <xsl:stylesheet version="1.0" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| xmlns:ds="http://www.w3.org/2000/09/xmldsig#" | ||
| xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> | ||
|
|
||
| <!-- | ||
| The stylesheet output will be a text file, which will probably be thrown | ||
| away in any case. The real output from the check is sent using the | ||
| xsl:message element. | ||
| --> | ||
| <xsl:output method="text"/> | ||
|
|
||
|
|
||
| <!-- | ||
| Checks for an IdP whose KeyDescriptor elements do not include a @use attribute. | ||
| This causes problems with certain versions of the Shibboleth 1.3 SP, which | ||
| interpret this as "no use permitted" rather than "either signing or encryption use | ||
| permitted". | ||
| Two checks are required, one for each of the IdP role descriptors. | ||
| --> | ||
|
|
||
| <xsl:template match="md:IDPSSODescriptor/md:KeyDescriptor[not(@use)]"> | ||
| <xsl:call-template name="fatal"> | ||
| <xsl:with-param name="m">IdP SSO KeyDescriptor lacking @use</xsl:with-param> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
|
|
||
| <xsl:template match="md:AttributeAuthorityDescriptor/md:KeyDescriptor[not(@use)]"> | ||
| <xsl:call-template name="fatal"> | ||
| <xsl:with-param name="m">IdP AA KeyDescriptor lacking @use</xsl:with-param> | ||
| </xsl:call-template> | ||
| </xsl:template> | ||
|
|
||
|
|
||
| <!-- | ||
| Common template to call to report a fatal error on some element within an entity. | ||
| --> | ||
| <xsl:template name="fatal"> | ||
| <xsl:param name="m"/> | ||
| <xsl:message terminate='no'> | ||
| <xsl:text>*** </xsl:text> | ||
| <xsl:value-of select="ancestor::md:EntityDescriptor/@ID"/> | ||
| <xsl:text>: </xsl:text> | ||
| <xsl:value-of select="$m"/> | ||
| </xsl:message> | ||
| </xsl:template> | ||
|
|
||
|
|
||
| <!-- Recurse down through all elements by default. --> | ||
| <xsl:template match="*"> | ||
| <xsl:apply-templates select="node()|@*"/> | ||
| </xsl:template> | ||
|
|
||
| <!-- Discard text blocks, comments and attributes by default. --> | ||
| <xsl:template match="text()|comment()|@*"> | ||
| <!-- do nothing --> | ||
| </xsl:template> | ||
|
|
||
| </xsl:stylesheet> |