Skip to content

Commit

Permalink
Charting for SAML 2 penetration.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Dec 14, 2009
1 parent 7a1bc01 commit a2b1731
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
49 changes: 49 additions & 0 deletions charting/saml2.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/perl -w

#
# saml2.pl
#
# Extracts statistics about SAML 2 adoption from the published metadata.
#
use lib "../build";
use Xalan;

@months = (
'2006-12',
'2007-01', '2007-02', '2007-03', '2007-04', '2007-05', '2007-06',
'2007-07', '2007-08', '2007-09', '2007-10', '2007-11', '2007-12',
'2008-01', '2008-02', '2008-03', '2008-04', '2008-05', '2008-06',
'2008-07', '2008-08', '2008-09', '2008-10', '2008-11', '2008-12',
'2009-01', '2009-02', '2009-03', '2009-04', '2009-05', '2009-06',
'2009-07', '2009-08', '2009-09', '2009-10', '2009-11', '2009-12',
);

# ingest files
foreach $month (@months) {
my $fn = "cache/$month.xml";
open(TXT, xalanCall . " -IN $fn -XSL saml2.xsl|") || die "could not open input file";
$_ = <TXT>;
chop;
my ($entities, $idps, $sps, $saml2total, $saml2idp, $saml2sp) = split;
push @overallRatio, $saml2total/$entities;
push @idpRatio, $saml2idp/$idps;
push @spRatio, $saml2sp/$sps;
close TXT;
}

print "idp\n";
foreach $ratio (@idpRatio) {
print "$ratio\n";
}

print "sp\n";
foreach $ratio (@spRatio) {
print "$ratio\n";
}

print "overall\n";
foreach $ratio (@overallRatio) {
print "$ratio\n";
}

1;
50 changes: 50 additions & 0 deletions charting/saml2.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
saml2.xsl
XSL stylesheet that takes a SAML 2.0 metadata file and extracts
statistics about the level of SAML 2 protocol support within the
included entities.
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="md">

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

<xsl:template match="md:EntitiesDescriptor">
<xsl:variable name="entities" select="//md:EntityDescriptor"/>
<xsl:value-of select="count($entities)"/><xsl:text> </xsl:text>
<xsl:variable name="idps" select="$entities[md:IDPSSODescriptor]"/>
<xsl:value-of select="count($idps)"/><xsl:text> </xsl:text>
<xsl:variable name="sps" select="$entities[md:SPSSODescriptor]"/>
<xsl:value-of select="count($sps)"/><xsl:text> </xsl:text>

<xsl:variable name="entities.saml2"
select="$entities[
md:IDPSSODescriptor[contains(@protocolSupportEnumeration, 'urn:oasis:names:tc:SAML:2.0:protocol')] |
md:SPSSODescriptor[contains(@protocolSupportEnumeration, 'urn:oasis:names:tc:SAML:2.0:protocol')]
]"/>
<xsl:value-of select="count($entities.saml2)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($entities[
md:IDPSSODescriptor[contains(@protocolSupportEnumeration, 'urn:oasis:names:tc:SAML:2.0:protocol')]
])"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($entities[
md:SPSSODescriptor[contains(@protocolSupportEnumeration, 'urn:oasis:names:tc:SAML:2.0:protocol')]
])"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>

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

0 comments on commit a2b1731

Please sign in to comment.