Skip to content

Commit

Permalink
Stylesheet and perl script which, combined, list the SAML 2.0 support…
Browse files Browse the repository at this point in the history
… for a list of entities given by ID attribute value (@ID, not @entityID).
  • Loading branch information
iay committed Apr 12, 2011
1 parent bce255e commit 71e6834
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
24 changes: 24 additions & 0 deletions attic/extract_saml2sp.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/perl -w

use Xalan;

open(XML, xalanCall . " -IN ../xml/ukfederation-metadata-unsigned.xml -XSL extract_saml2sp.xsl|") || die "could not open input file";
while (<XML>) {
my ($id, $result) = split;
$results{$id} = $result;
print $_;
}
close XML;

open(IDS, "ids.txt") || die "could not open ids file";
while (<IDS>) {
chop;
$id = $_;
if (defined $results{$id}) {
$result = $results{$id};
} else {
$result = 'SP?';
}
print "$result\n";
}
close IDS;
37 changes: 37 additions & 0 deletions attic/extract_saml2sp.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
extract_saml2sp.xsl
XSL stylesheet that takes a SAML 2.0 metadata aggregate and extracts
SAML 2.0 support information for each SP entity.
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"
exclude-result-prefixes="md ds">

<!-- Output is plain text -->
<xsl:output method="text"/>

<xsl:template match="//md:EntityDescriptor[md:SPSSODescriptor]">
<xsl:value-of select="@ID"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="contains(md:SPSSODescriptor/@protocolSupportEnumeration,
'urn:oasis:names:tc:SAML:2.0:protocol')">yes</xsl:when>
<xsl:otherwise>no</xsl:otherwise>
</xsl:choose>
<xsl:text>&#x0a;</xsl:text>
</xsl:template>

<xsl:template match="text()">
<!-- do nothing -->
</xsl:template>

</xsl:stylesheet>

0 comments on commit 71e6834

Please sign in to comment.