diff options
author | Leif Johansson <leifj@sunet.se> | 2019-01-14 10:34:54 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2019-01-14 10:34:54 +0100 |
commit | 457533034d1e0070323f9ca49a4bf8ddde5f882e (patch) | |
tree | 695d2878f76faffc5715e1ea2bb855c77936d9f9 /xslt |
initial import
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/clean-entitydescriptor.xsl | 30 | ||||
-rw-r--r-- | xslt/dbg-summary.xslt | 18 | ||||
-rw-r--r-- | xslt/entity_id_list.xslt | 26 | ||||
-rw-r--r-- | xslt/extract-idp.xslt | 25 | ||||
-rw-r--r-- | xslt/extract-non-idp.xslt | 25 | ||||
-rw-r--r-- | xslt/filter-idp.xslt | 32 | ||||
-rw-r--r-- | xslt/full-summary.xslt | 18 | ||||
-rw-r--r-- | xslt/idp-list.xslt | 25 | ||||
-rw-r--r-- | xslt/idp-summary.xslt | 112 | ||||
-rw-r--r-- | xslt/import-mdservicelist.xsl | 42 | ||||
-rw-r--r-- | xslt/import-metadata.xsl | 83 | ||||
-rw-r--r-- | xslt/list-locations.xslt | 21 | ||||
-rw-r--r-- | xslt/mdslgen.xsl | 54 | ||||
-rw-r--r-- | xslt/normalize.xsl | 124 | ||||
-rw-r--r-- | xslt/sign-luna-sha256-excl.xsl | 48 | ||||
-rw-r--r-- | xslt/sign-luna-sha256.xsl | 48 | ||||
-rw-r--r-- | xslt/sign-luna.xsl | 48 | ||||
-rw-r--r-- | xslt/sign.xsl | 52 | ||||
-rw-r--r-- | xslt/sp-summary.xslt | 126 | ||||
-rw-r--r-- | xslt/summary.xslt | 102 | ||||
-rw-r--r-- | xslt/tidy.xsl | 30 |
21 files changed, 1089 insertions, 0 deletions
diff --git a/xslt/clean-entitydescriptor.xsl b/xslt/clean-entitydescriptor.xsl new file mode 100644 index 0000000..c1c31df --- /dev/null +++ b/xslt/clean-entitydescriptor.xsl @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + <xsl:param name="indent-increment" select="' '"/> + <xsl:strip-space elements="*" /> + + <xsl:template match="@ID"/> + <xsl:template match="@validUntil"/> + <xsl:template match="@cacheDuration"/> + <xsl:template match="ds:Signature"/> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/dbg-summary.xslt b/xslt/dbg-summary.xslt new file mode 100644 index 0000000..2550ae0 --- /dev/null +++ b/xslt/dbg-summary.xslt @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:import href="summary.xslt"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <xsl:apply-templates select="md:EntityDescriptor"/> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/entity_id_list.xslt b/xslt/entity_id_list.xslt new file mode 100644 index 0000000..bda1bb7 --- /dev/null +++ b/xslt/entity_id_list.xslt @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="text" indent="yes" encoding="UTF-8"/> + + <xsl:template match="md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="md:EntityDescriptor"/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xsl:text>- </xsl:text><xsl:value-of select="@entityID"/><xsl:text> +</xsl:text> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/extract-idp.xslt b/xslt/extract-idp.xslt new file mode 100644 index 0000000..3282438 --- /dev/null +++ b/xslt/extract-idp.xslt @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="md:EntityDescriptor[md:IDPSSODescriptor]"/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xi:include><xsl:attribute name="href"><xsl:value-of select="@xml:base"/></xsl:attribute></xi:include> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/extract-non-idp.xslt b/xslt/extract-non-idp.xslt new file mode 100644 index 0000000..b12c587 --- /dev/null +++ b/xslt/extract-non-idp.xslt @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="md:EntityDescriptor[not(md:IDPSSODescriptor)]"/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xi:include><xsl:attribute name="href"><xsl:value-of select="@xml:base"/></xsl:attribute></xi:include> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/filter-idp.xslt b/xslt/filter-idp.xslt new file mode 100644 index 0000000..868bc1a --- /dev/null +++ b/xslt/filter-idp.xslt @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="md:EntityDescriptor[md:IDPSSODescriptor]"/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + + +</xsl:stylesheet> diff --git a/xslt/full-summary.xslt b/xslt/full-summary.xslt new file mode 100644 index 0000000..bf127df --- /dev/null +++ b/xslt/full-summary.xslt @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:import href="http://mds.swamid.se/xslt/summary.xslt"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <xsl:apply-templates select="md:EntityDescriptor"/> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/idp-list.xslt b/xslt/idp-list.xslt new file mode 100644 index 0000000..0d18be8 --- /dev/null +++ b/xslt/idp-list.xslt @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="md:EntityDescriptor[md:IDPSSODescriptor]"/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xi:include><xsl:attribute name="href"><xsl:value-of select="@xml:base"/></xsl:attribute></xi:include> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/idp-summary.xslt b/xslt/idp-summary.xslt new file mode 100644 index 0000000..90e57ad --- /dev/null +++ b/xslt/idp-summary.xslt @@ -0,0 +1,112 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:samla="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute" + xmlns:remd="http://refeds.org/metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="text"/> + <xsl:variable name="eol"> +<xsl:text>|</xsl:text><xsl:text> +</xsl:text> + </xsl:variable> + + <xsl:template name="entity-name"> + <xsl:variable name="h"><xsl:value-of select="substring-after(@entityID,'://')"/></xsl:variable> + <xsl:if test="contains($h,'/')"> + <xsl:value-of select="substring-before($h,'/')"/> + </xsl:if> + <xsl:if test="not(contains($h,'/'))"> + <xsl:value-of select="$h"/> + </xsl:if> + </xsl:template> + + <xsl:template match="/md:EntitiesDescriptor"> + <xsl:text>||EntityID||Organization||Technical Contact||Support Contact||Security Contact||Administrative Contact||Scopes||Entity category support||Assurance Certification|| +</xsl:text> + <xsl:apply-templates select="md:EntityDescriptor[md:IDPSSODescriptor]"/> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xsl:text> | </xsl:text><xsl:value-of select="@entityID"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:Organization"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='technical']"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='support']"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@remd:contactType='http://refeds.org/metadata/contactType/security']"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='administrative']"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:IDPSSODescriptor"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:Extensions/mdattr:EntityAttributes/samla:Attribute[@Name='http://macedir.org/entity-category-support']/samla:AttributeValue"/><xsl:text> </xsl:text> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:Extensions/mdattr:EntityAttributes/samla:Attribute[@Name='urn:oasis:names:tc:SAML:attribute:assurance-certification']/samla:AttributeValue"/><xsl:text> </xsl:text> + <xsl:text> | +</xsl:text> + </xsl:template> + + <xsl:template match="md:ContactPerson"> + <xsl:apply-templates select="md:EmailAddress"/> + </xsl:template> + + <xsl:template match="md:Organization"> + <xsl:text>[</xsl:text> + <xsl:apply-templates select="md:OrganizationDisplayName[1]"/><xsl:text>|</xsl:text><xsl:apply-templates select="md:OrganizationURL[1]"/><xsl:text>]</xsl:text> + </xsl:template> + + <xsl:template match="md:IDPSSODescriptor"> + <xsl:apply-templates select="md:Extensions/shibmd:Scope"/> + </xsl:template> + + <xsl:template match="md:EmailAddress"> + <xsl:value-of select="normalize-space(text())"/><xsl:text> </xsl:text><xsl:text> \\</xsl:text> + </xsl:template> + + <xsl:template match="md:OrganizationDisplayName"> + <xsl:value-of select="normalize-space(text())"/><xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="md:OrganizationURL"> + <xsl:value-of select="normalize-space(text())"/><xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="shibmd:Scope"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="samla:AttributeValue"> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="text()" /> + <xsl:with-param name="replace" select="'-'" /> + <xsl:with-param name="by" select="'&#x2011;'" /> + </xsl:call-template> + <xsl:text> \\</xsl:text> + </xsl:template> + + <xsl:template match="*"/> + <xsl:template match="text()"/> + + <xsl:template name="string-replace-all"> + <xsl:param name="text" /> + <xsl:param name="replace" /> + <xsl:param name="by" /> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text,$replace)" /> + <xsl:value-of select="$by" /> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="substring-after($text,$replace)" /> + <xsl:with-param name="replace" select="$replace" /> + <xsl:with-param name="by" select="$by" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/import-mdservicelist.xsl b/xslt/import-mdservicelist.xsl new file mode 100644 index 0000000..fb7522b --- /dev/null +++ b/xslt/import-mdservicelist.xsl @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:ser="http://eidas.europa.eu/metadata/servicelist" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/ser:MetadataServiceList"> + <xsl:apply-templates select="ser:MetadataList"/> + </xsl:template> + + <xsl:template match="ser:MetadataList"> + <xsl:variable name="country"> + <xsl:value-of select="@Territory"/> + </xsl:variable> + + <xsl:variable name="file" select="concat($output,'/',$country,'.xml')"/> + <exsl:document method="xml" indent="yes" href="{$file}"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </exsl:document> + </xsl:template> + + <xsl:template match="@ID"/> + <xsl:template match="ds:Signature"/> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/import-metadata.xsl b/xslt/import-metadata.xsl new file mode 100644 index 0000000..2edf7ed --- /dev/null +++ b/xslt/import-metadata.xsl @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template name="string-replace-all"> + <xsl:param name="text" /> + <xsl:param name="replace" /> + <xsl:param name="by" /> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text,$replace)" /> + <xsl:value-of select="$by" /> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="substring-after($text,$replace)" /> + <xsl:with-param name="replace" select="$replace" /> + <xsl:with-param name="by" select="$by" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="/md:EntitiesDescriptor"> + <xsl:apply-templates select="md:EntityDescriptor"> + <!-- xsl:with-param name="output"><xsl:value-of select="$output"/></xsl:with-param --> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <!-- xsl:param name="output"/ --> + <xsl:variable name="uri"> + <xsl:choose> + <xsl:when test="contains(@entityID,'://')"> + <xsl:value-of select="substring-after(@entityID,'://')"/> + </xsl:when> + <xsl:otherwise><xsl:value-of select="@entityID"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="hostStr"> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="$uri" /> + <xsl:with-param name="replace" select="'%2F'" /> + <xsl:with-param name="by" select="'/'" /> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="host"> + <xsl:value-of select="normalize-space(translate($hostStr,'/?=:','----'))"/> + </xsl:variable> + <xsl:variable name="file" select="concat($output,'/',$host,'.xml')"/> + <exsl:document method="xml" indent="yes" href="{$file}"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </exsl:document> + </xsl:template> + + <xsl:template match="@ID"/> + <xsl:template match="ds:Signature"/> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/list-locations.xslt b/xslt/list-locations.xslt new file mode 100644 index 0000000..fd22fac --- /dev/null +++ b/xslt/list-locations.xslt @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="text"/> + + <xsl:template match="//*[@Location]"> + <xsl:value-of select="@Location"/><xsl:text> +</xsl:text> + </xsl:template> + <xsl:template match="text()"/> + +</xsl:stylesheet> diff --git a/xslt/mdslgen.xsl b/xslt/mdslgen.xsl new file mode 100644 index 0000000..ac0110a --- /dev/null +++ b/xslt/mdslgen.xsl @@ -0,0 +1,54 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:ser="http://eidas.europa.eu/metadata/servicelist" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + <xsl:param name="type"/> + + <xsl:template match="//xi:include"> + <xsl:apply-templates select="document(@href)"> + <with-param name="type"><xsl:value-of select="@type"/></with-param> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <ser:MetadataLocation> + <xsl:attribute name="Location"><xsl:value-of select="@entityID"/></xsl:attribute> + <ser:Endpoint> + <xsl:attribute name="EndpointType"><xsl:value-of select="$type"/></xsl:attribute> + <xsl:attribute name="EntityID"><xsl:value-of select="@entityID"/></xsl:attribute> + </ser:Endpoint> + <xsl:apply-templates select="ds:Signature"/> + </ser:MetadataLocation> + </xsl:template> + + <xsl:template match="ds:Signature"> + <xsl:apply-templates select="ds:KeyInfo"/> + </xsl:template> + + <xsl:template match="ds:KeyInfo"> + <xsl:copy> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/normalize.xsl b/xslt/normalize.xsl new file mode 100644 index 0000000..015f841 --- /dev/null +++ b/xslt/normalize.xsl @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:exsl="http://exslt.org/common" + xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <xsl:if test="$tou='true'"><xsl:comment> + + IMPORTANT NOTICE: READ CAREFULLY + +You are reading this because You wish to use the technical information (the “Metadata”) +published on behalf of the Registrars. These Terms of Access and Use (these “Terms”) govern +the use of the Metadata. By accessing or using the Metadata You accept that the access and +use will be on and subject to these Terms. These Terms will be binding and enforceable on +You as contractual obligations. + +The SWAMID Metadata Terms of Access and Use can be found here: + +- http://mds.swamid.se/md/swamid-tou-sv.txt Swedish version - Legally Binding! +- http://mds.swamid.se/md/swamid-tou-en.txt English version - Non-normative translation + +If You do not accept these Terms, then You must not continue to use this Metadata. + + </xsl:comment></xsl:if> + <md:EntitiesDescriptor> + <xsl:attribute name="ID"><xsl:value-of select="$ID"/></xsl:attribute> + <xsl:attribute name="Name"> + <xsl:choose> + <xsl:when test="$target"><xsl:value-of select="$target"/></xsl:when> + <xsl:otherwise><xsl:value-of select="@Name"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:if test="@cacheDuration"> + <xsl:attribute name="cacheDuration"><xsl:value-of select="@cacheDuration"/></xsl:attribute> + </xsl:if> + <xsl:if test="@validUntil"> + <xsl:attribute name="validUntil"><xsl:value-of select="$date"/></xsl:attribute> + </xsl:if> + <xsl:if test="$target"> + <md:Extensions><xsl:call-template name="add-swamid-pi"/></md:Extensions> + </xsl:if> + <xsl:apply-templates/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xsl:variable name="path"><xsl:value-of select="substring-after(@entityID,'://')"/></xsl:variable> + <xsl:variable name="host"> + <xsl:if test="contains($path,'/')"> + <xsl:value-of select="substring-before($path,'/')"/> + </xsl:if> + <xsl:if test="not(contains($path,'/'))"> + <xsl:value-of select="$path"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="domain"> + <xsl:value-of select="substring-after($host,'.')"/> + </xsl:variable> + <xsl:variable name="orginfo"> + <xsl:value-of select="concat('../organization','/',$domain,'.xml')"/> + </xsl:variable> + <md:EntityDescriptor> + <xsl:apply-templates select="@*"/> + <xsl:if test="$rpi='true' and not(md:Extensions)"> + <md:Extensions><xsl:call-template name="add-swamid-ri"/></md:Extensions> + </xsl:if> + <xsl:apply-templates select="text()|comment()|md:Extensions|md:RoleDescriptor|md:IDPSSODescriptor|md:SPSSODescriptor|md:AuthnAuthorityDescriptor|md:AttributeAuthorityDescriptor|md:PDPDescriptor|md:AffiliationDescriptor"/> + <xsl:if test="$org='true' and not(md:Organization)"> + <xsl:apply-templates select="document($orginfo)"/> + </xsl:if> + <xsl:apply-templates select="md:Organization"/> + <xsl:if test="$defaultContact='true' and not(md:ContactPerson)"> + <md:ContactPerson contactType="technical"><md:EmailAddress>operations@swamid.se</md:EmailAddress></md:ContactPerson> + </xsl:if> + <xsl:apply-templates select="md:ContactPerson"/> + <xsl:apply-templates select="md:AdditionalMetadataLocation"/> + </md:EntityDescriptor> + </xsl:template> + + <xsl:template match="md:EntityDescriptor/md:Extensions"> + <md:Extensions> + <xsl:call-template name="add-swamid-ri"/> + <xsl:apply-templates select="text()|comment()|node()"/> + </md:Extensions> + </xsl:template> + + <xsl:template name="add-swamid-ri"> + <xsl:if test="$rpi='true' and not(mdrpi:RegistrationInfo[@registrationAuthority='http://swamid.se/'])"> + <mdrpi:RegistrationInfo registrationAuthority="http://www.swamid.se/"> + <mdrpi:RegistrationPolicy xml:lang="en">https://www.sunet.se/wp-content/uploads/2016/08/SWAMID-Metadata-Registration-Practice-Statement-v2.pdf</mdrpi:RegistrationPolicy> + </mdrpi:RegistrationInfo> + </xsl:if> + </xsl:template> + + <xsl:template name="add-swamid-pi"> + <mdrpi:PublicationInfo> + <xsl:attribute name="creationInstant"><xsl:value-of select="$now"/></xsl:attribute> + <xsl:attribute name="publisher"><xsl:value-of select="$target"/></xsl:attribute> + <mdrpi:UsagePolicy xml:lang="en">https://www.sunet.se/wp-content/uploads/2015/12/SWAMID-Terms-of-Use-20110714.pdf</mdrpi:UsagePolicy> + </mdrpi:PublicationInfo> + </xsl:template> + + <xsl:template match="@xml:base|@ID|@validUntil|@cacheDuration"/> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/sign-luna-sha256-excl.xsl b/xslt/sign-luna-sha256-excl.xsl new file mode 100644 index 0000000..08e4827 --- /dev/null +++ b/xslt/sign-luna-sha256-excl.xsl @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:exsl="http://exslt.org/common" + xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="@*|text()|comment()"/> + <ds:Signature> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> + <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /> + <ds:Reference> + <xsl:attribute name="URI"><xsl:text>#</xsl:text><xsl:value-of select="@ID"/></xsl:attribute> + <ds:Transforms> + <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> + <ds:DigestValue></ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue/> + </ds:Signature> + <xsl:apply-templates/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/sign-luna-sha256.xsl b/xslt/sign-luna-sha256.xsl new file mode 100644 index 0000000..293bb96 --- /dev/null +++ b/xslt/sign-luna-sha256.xsl @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:exsl="http://exslt.org/common" + xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="@*|text()|comment()"/> + <ds:Signature> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> + <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /> + <ds:Reference> + <xsl:attribute name="URI"><xsl:text>#</xsl:text><xsl:value-of select="@ID"/></xsl:attribute> + <ds:Transforms> + <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> + <ds:DigestValue></ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue/> + </ds:Signature> + <xsl:apply-templates/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/sign-luna.xsl b/xslt/sign-luna.xsl new file mode 100644 index 0000000..4836451 --- /dev/null +++ b/xslt/sign-luna.xsl @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:exsl="http://exslt.org/common" + xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="@*|text()|comment()"/> + <ds:Signature> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> + <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> + <ds:Reference> + <xsl:attribute name="URI"><xsl:text>#</xsl:text><xsl:value-of select="@ID"/></xsl:attribute> + <ds:Transforms> + <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> + <ds:DigestValue></ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue/> + </ds:Signature> + <xsl:apply-templates/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/sign.xsl b/xslt/sign.xsl new file mode 100644 index 0000000..51d2492 --- /dev/null +++ b/xslt/sign.xsl @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:exsl="http://exslt.org/common" + xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> + + <xsl:template match="/md:EntitiesDescriptor"> + <md:EntitiesDescriptor> + <xsl:apply-templates select="@*|text()|comment()"/> + <ds:Signature> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> + <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> + <ds:Reference> + <xsl:attribute name="URI"><xsl:text>#</xsl:text><xsl:value-of select="@ID"/></xsl:attribute> + <ds:Transforms> + <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> + <ds:DigestValue></ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue/> + <ds:KeyInfo> + <ds:X509Data> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <xsl:apply-templates/> + </md:EntitiesDescriptor> + </xsl:template> + + <xsl:template match="text()|comment()|@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/sp-summary.xslt b/xslt/sp-summary.xslt new file mode 100644 index 0000000..d54141c --- /dev/null +++ b/xslt/sp-summary.xslt @@ -0,0 +1,126 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute" + xmlns:samla="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="text"/> + <xsl:variable name="eol"> +<xsl:text>|</xsl:text><xsl:text> +</xsl:text> + </xsl:variable> + + <xsl:template name="entity-name"> + <xsl:variable name="h"><xsl:value-of select="substring-after(@entityID,'://')"/></xsl:variable> + <xsl:if test="contains($h,'/')"> + <xsl:value-of select="substring-before($h,'/')"/> + </xsl:if> + <xsl:if test="not(contains($h,'/'))"> + <xsl:value-of select="$h"/> + </xsl:if> + </xsl:template> + + <xsl:template match="/md:EntitiesDescriptor"> + <xsl:text>||EntityID||Service Name||Service Description||Organization||Technical Contact||Administrative Contact||Entity Categories|| +</xsl:text> + <xsl:apply-templates select="md:EntityDescriptor[md:SPSSODescriptor]"/> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xsl:text> | </xsl:text><xsl:value-of select="@entityID"/> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceName"/> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceDescription"/> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:Organization"/> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='technical']"/> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:ContactPerson[@contactType='administrative']"/> + <xsl:text> | </xsl:text><xsl:apply-templates select="md:Extensions/mdattr:EntityAttributes/samla:Attribute[@Name='http://macedir.org/entity-category']/samla:AttributeValue"/><xsl:text> | +</xsl:text> + </xsl:template> + + <xsl:template match="md:AttributeConsumingService"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="md:ServiceDescription"> + <xsl:value-of select="normalize-space(text())"/><xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="md:ServiceName"> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="text()" /> + <xsl:with-param name="replace" select="'|'" /> + <xsl:with-param name="by" select="'\|'" /> + </xsl:call-template> + </xsl:template> + + <xsl:template match="samla:AttributeValue"> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="substring-after(text(),'/category/')" /> + <xsl:with-param name="replace" select="'-'" /> + <xsl:with-param name="by" select="'&#x2011;'" /> + </xsl:call-template> + <xsl:text> \\</xsl:text> + </xsl:template> + + <xsl:template match="md:ContactPerson"> + <xsl:apply-templates select="md:EmailAddress"/> + </xsl:template> + + <xsl:template match="md:Organization"> + <xsl:text>[</xsl:text> + <xsl:apply-templates select="md:OrganizationDisplayName[1]"/><xsl:text>|</xsl:text> + <xsl:apply-templates select="md:OrganizationURL[1]"/><xsl:text>]</xsl:text> + </xsl:template> + + <xsl:template match="md:SPPSSODescriptor"> + <xsl:apply-templates select="md:Extensions/shibmd:Scope"/> + </xsl:template> + + <xsl:template match="md:EmailAddress"> + <xsl:value-of select="text()"/><xsl:text> \\</xsl:text> + </xsl:template> + + <xsl:template match="md:OrganizationDisplayName"> + <xsl:value-of select="normalize-space(text())"/> + </xsl:template> + + <xsl:template match="md:OrganizationURL"> + <xsl:value-of select="normalize-space(text())"/> + </xsl:template> + + <xsl:template match="shibmd:Scope"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:template> + + + <xsl:template match="*"/> + <xsl:template match="text()"/> + + <xsl:template name="string-replace-all"> + <xsl:param name="text" /> + <xsl:param name="replace" /> + <xsl:param name="by" /> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text,$replace)" /> + <xsl:value-of select="$by" /> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="substring-after($text,$replace)" /> + <xsl:with-param name="replace" select="$replace" /> + <xsl:with-param name="by" select="$by" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/xslt/summary.xslt b/xslt/summary.xslt new file mode 100644 index 0000000..05152d1 --- /dev/null +++ b/xslt/summary.xslt @@ -0,0 +1,102 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"> + + <xsl:output method="text"/> + <xsl:variable name="eol"> +<xsl:text>|</xsl:text><xsl:text> +</xsl:text> + </xsl:variable> + + <xsl:template name="entity-name"> + <xsl:variable name="h"><xsl:value-of select="substring-after(@entityID,'://')"/></xsl:variable> + <xsl:if test="contains($h,'/')"> + <xsl:value-of select="substring-before($h,'/')"/> + </xsl:if> + <xsl:if test="not(contains($h,'/'))"> + <xsl:value-of select="$h"/> + </xsl:if> + </xsl:template> + + <xsl:template match="md:EntityDescriptor"> + <xsl:text>h2. </xsl:text><xsl:call-template name="entity-name"/><xsl:text> +</xsl:text> + <xsl:text>||EntityID|</xsl:text><xsl:value-of select="@entityID"/><xsl:value-of select="$eol"/> + <xsl:apply-templates select="md:IDPSSODescriptor"/> + <xsl:apply-templates select="md:SPSSODescriptor"/> + <xsl:apply-templates select="md:Organization"/> + <xsl:apply-templates select="md:ContactPerson"/> + <xsl:text> +</xsl:text> + <xsl:apply-templates select="md:SPSSODescriptor/md:AttributeConsumingService"/><xsl:text> +</xsl:text> + <xsl:text>[Supplemental documentation|</xsl:text><xsl:call-template name="entity-name"/><xsl:text>] +</xsl:text> + <xsl:text> +</xsl:text> + </xsl:template> + + <xsl:template match="md:ContactPerson[@contactType='technical']"> + <xsl:text>||Technical contact|</xsl:text> + <xsl:apply-templates select="md:EmailAddress"/> + <xsl:value-of select="$eol"/> + </xsl:template> + + <xsl:template match="md:ContactPerson[@contactType='administrative']"> + <xsl:text>||Administrative contact|</xsl:text> + <xsl:apply-templates select="md:EmailAddress"/> + <xsl:value-of select="$eol"/> + </xsl:template> + + <xsl:template match="md:Organization"> + <xsl:text>||Organization|[</xsl:text> + <xsl:apply-templates select="md:OrganizationDisplayName[1]"/><xsl:text>|</xsl:text><xsl:apply-templates select="md:OrganizationURL[1]"/><xsl:text>]</xsl:text> + <xsl:value-of select="$eol"/> + </xsl:template> + + <xsl:template match="md:SPSSODescriptor"> + <xsl:text>||Role|Service Provider</xsl:text><xsl:value-of select="$eol"/> + </xsl:template> + + <xsl:template match="md:AttributeConsumingService"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="md:ServiceDescription"> + <xsl:text>{info}</xsl:text><xsl:value-of select="text()"/><xsl:text>{info}</xsl:text> + </xsl:template> + + <xsl:template match="md:IDPSSODescriptor"> + <xsl:text>||Role|Identity Provider</xsl:text><xsl:value-of select="$eol"/> + <xsl:text>||Scopes|</xsl:text><xsl:apply-templates select="md:Extensions/shibmd:Scope"/><xsl:value-of select="$eol"/> + </xsl:template> + + <xsl:template match="md:EmailAddress"> + <xsl:value-of select="text()"/> + </xsl:template> + + <xsl:template match="md:OrganizationDisplayName"> + <xsl:value-of select="text()"/> + </xsl:template> + + <xsl:template match="md:OrganizationURL"> + <xsl:value-of select="text()"/> + </xsl:template> + + <xsl:template match="shibmd:Scope"> + <xsl:text>* </xsl:text><xsl:value-of select="text()"/><xsl:text> +</xsl:text> + </xsl:template> + + + <xsl:template match="*"/> + <xsl:template match="text()"/> + +</xsl:stylesheet> diff --git a/xslt/tidy.xsl b/xslt/tidy.xsl new file mode 100644 index 0000000..043ef07 --- /dev/null +++ b/xslt/tidy.xsl @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="2.0" + xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:template match="@ID"/> + <xsl:template match="@validUntil"/> + <xsl:template match="@cacheDuration"/> + <xsl:template match="@xml:base"/> + <xsl:template match="md:OrganizationName|md:OrganizationURL|md:OrganizationDisplayName"> + <xsl:if test="normalize-space(text()) != ''"> + <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy> + </xsl:if> + </xsl:template> + + <xsl:template match="text()|comment()|@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="/*"> + <xsl:element name="md:{local-name()}" namespace="urn:oasis:names:tc:SAML:2.0:metadata"> + <!-- xsl:namespace name="xsi" select="'http://www.w3.org/2001/XMLSchema-instance'"/ --> + <xsl:namespace name="xs" select="'http://www.w3.org/2001/XMLSchema'"/> + <xsl:apply-templates select="@*|node()"/> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> |