Skip to content

Commit

Permalink
Charting for trust models.
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Feb 3, 2010
1 parent 706e9fe commit 25d32b7
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
58 changes: 58 additions & 0 deletions charting/trust.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/perl -w

#
# trust.pl
#
# Extracts statistics about trust model support from the published metadata.
#
use lib "../build";
use Xalan;
use Months;

# ingest files
foreach $month (@months) {
my $fn = "cache/$month.xml";
open(TXT, xalanCall . " -IN $fn -XSL trust.xsl|") || die "could not open input file";
$_ = <TXT>;
chop;
my ($entities, $idps, $sps, $dk_total, $dk_idp, $dk_sp, $pk_total, $pk_idp, $pk_sp) = split;
push @overallRatio, $dk_total/$entities;
push @idpRatio, $dk_idp/$idps;
push @spRatio, $dk_sp/$sps;
push @PKoverallRatio, $pk_total/$entities;
push @PKidpRatio, $pk_idp/$idps;
push @PKspRatio, $pk_sp/$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";
}

print "PKidp\n";
foreach $ratio (@PKidpRatio) {
print "$ratio\n";
}

print "PKsp\n";
foreach $ratio (@PKspRatio) {
print "$ratio\n";
}

print "PKoverall\n";
foreach $ratio (@PKoverallRatio) {
print "$ratio\n";
}

1;
50 changes: 50 additions & 0 deletions charting/trust.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
trust.xsl
XSL stylesheet that takes a SAML 2.0 metadata file and extracts
statistics about the different trust models used 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: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">

<!-- 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:value-of select="count($entities[descendant::ds:X509Data])"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($idps[descendant::ds:X509Data])"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($sps[descendant::ds:X509Data])"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($entities[descendant::ds:KeyName])"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($idps[descendant::ds:KeyName])"/>
<xsl:text> </xsl:text>
<xsl:value-of select="count($sps[descendant::ds:KeyName])"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>

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

0 comments on commit 25d32b7

Please sign in to comment.