Skip to content

Commit

Permalink
Merge branch 'upstream' for incommon v11
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Apr 15, 2022
2 parents aa621fb + 47d6766 commit b56e8ee
Show file tree
Hide file tree
Showing 118 changed files with 3,957 additions and 514 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Thumbs.db

# /build/
/build/locations.txt
/build/orgnamescope.html
/build/randssps.html
/build/uai.html
/build/dml.html
/build/locations_noports.txt

# /charting/
/charting/cache
Expand Down
446 changes: 367 additions & 79 deletions build.xml

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions charting/requestedattribute.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env perl

#
# requestedattribute.pl
#
# Extracts statistics about SPs with RequestedAttribute elements from the published metadata.
#
use warnings;
use lib ".";
use Months;

# Parse command line arguments
use Getopt::Long;
my $allMonths;
my $oneYear;
GetOptions('all' => \$allMonths, 'year' => \$oneYear);

# By default, only show results for the most recent month
if ($allMonths) {
# leave table intact
} elsif ($oneYear) {
# reduce months table to just the last 12 entries
@months = @months[-12..-1];
} else {
# reduce months table to one element
@months = @months[-1..-1];
}

# print header. must be kept in sync with what comes out of requestedattribute.xsl
print "# month, number of SPs, number with AttributeConsumingService, percent with ACS\n";

# ingest files
foreach $month (@months) {
my $fn = "cache/$month.xml";
open(TXT, "xsltproc requestedattribute.xsl $fn|") || die "could not open input file";
($sps, $acs) = split /\t/, <TXT>;
chomp $acs;
$proportion = 0;
if ( $sps > 0 ) { $proportion = int (100 * $acs / $sps) ; }
print "${month}\t${sps}\t${acs}\t${proportion}\n";
close TXT;
}

37 changes: 37 additions & 0 deletions charting/requestedattribute.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
requestedattribute.xsl
Takes a metadata aggregate and gives statistics about RequestedAttribute
elements in UKf-registered SPs.
Note that UKf metadata started using mdrpi:RegistrationInfo in 2012-09
so statistics before that date cannot be generated by this script.
-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">

<xsl:output method="text" omit-xml-declaration="yes"/>

<xsl:template match="/md:EntitiesDescriptor">

<xsl:variable name="sps" select="//md:EntityDescriptor
[descendant::mdrpi:RegistrationInfo/@registrationAuthority='http://ukfederation.org.uk']
[md:SPSSODescriptor]
"/>
<xsl:variable name="ACS" select="count($sps[md:SPSSODescriptor/md:AttributeConsumingService])"/>

<xsl:value-of select="count($sps)"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="$ACS"/>
<xsl:text>&#10;</xsl:text>

</xsl:template>

</xsl:stylesheet>
76 changes: 76 additions & 0 deletions mdx/_rules/check_saml2_lang.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Checking ruleset for elements with duplicate xml:lang
Originally reported in https://issues.shibboleth.net/jira/browse/IDP-1647
"Error with duplicate <ServiceDescription> with same xml:lang in the metadata"
This set of checks is for all appropriate elements in the namespace
urn:oasis:names:tc:SAML:2.0:metadata
-->
<xsl:stylesheet version="1.0"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:set="http://exslt.org/sets"
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"/>

<!--
Check for uniqueness within an AttributeConsumingService element
-->
<xsl:template match="md:AttributeConsumingService">
<!-- unique xml:lang over ServiceName elements -->
<xsl:call-template name="uniqueLang">
<xsl:with-param name="e" select="md:ServiceName"/>
</xsl:call-template>

<!-- unique xml:lang over ServiceDescription elements -->
<xsl:call-template name="uniqueLang">
<xsl:with-param name="e" select="md:ServiceDescription"/>
</xsl:call-template>

<!-- handle individual elements -->
<xsl:apply-templates select="*"/>
</xsl:template>

<!--
Check for uniqueness within an Organization element
-->
<xsl:template match="md:Organization">
<!-- unique xml:lang over OrganizationName elements -->
<xsl:call-template name="uniqueLang">
<xsl:with-param name="e" select="md:OrganizationName"/>
</xsl:call-template>

<!-- unique xml:lang over OrganizationDisplayName elements -->
<xsl:call-template name="uniqueLang">
<xsl:with-param name="e" select="md:OrganizationDisplayName"/>
</xsl:call-template>

<!-- handle individual elements -->
<xsl:apply-templates select="*"/>
</xsl:template>

<xsl:template name="uniqueLang">
<xsl:param name="e"/>
<xsl:variable name="l" select="$e/@xml:lang"></xsl:variable>
<xsl:variable name="u" select="set:distinct($l)"/>
<xsl:if test="count($l) != count($u)">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>non-unique lang values on </xsl:text>
<xsl:value-of select="name($e)"/>
<xsl:text> elements</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>

</xsl:stylesheet>
Loading

0 comments on commit b56e8ee

Please sign in to comment.