Skip to content

Commit

Permalink
Stop using TextUtils from sdss-xalan-md project
Browse files Browse the repository at this point in the history
Replace Xalan-based certificate data folding with a new ElementBase64WrappingStage stage from ukf-mda.
See ukf/ukf-meta#139.
  • Loading branch information
iay committed Feb 25, 2020
1 parent df25447 commit a88a38f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 29 deletions.
15 changes: 1 addition & 14 deletions mdx/clean-import.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
<xsl:stylesheet version="1.0"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdxTextUtils="xalan://uk.ac.sdss.xalan.md.TextUtils"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
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"
extension-element-prefixes="mdxTextUtils">
xmlns="urn:oasis:names:tc:SAML:2.0:metadata">

<!--Force UTF-8 encoding for the output.-->
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8" indent="yes"/>
Expand Down Expand Up @@ -45,17 +43,6 @@
<!-- Remove xsi:type from any entity attribute values. -->
<xsl:template match="saml:AttributeValue/@xsi:type"/>

<!--
Normalise whitespace in X509Certificate elements.
-->
<xsl:template match="ds:X509Certificate">
<xsl:element name="ds:X509Certificate">
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="mdxTextUtils:wrapBase64(.)"/>
<xsl:text>&#10;</xsl:text>
</xsl:element>
</xsl:template>

<!--
Discard various ds:X509 elements. Several of these are known to
cause problems with software systems, and they don't affect trust
Expand Down
13 changes: 13 additions & 0 deletions mdx/common-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@
***************************
-->

<bean id="ds-X509Certificate" parent="QName" c:_0-ref="ds_namespace"
c:_1="X509Certificate"/>

<!--
stripKeyNames
Expand All @@ -886,6 +889,15 @@
p:elementName="KeyName"
p:elementNamespace-ref="ds_namespace"/>

<!--
wrapX509Certificates
Normalise the text inside ds:X509Certificate elements by
removing all white space, then reformatting for 64 characters
per line.
-->
<bean id="wrapX509Certificates" parent="ukf.ElementBase64WrappingStage"
p:elementName-ref="ds-X509Certificate"/>


<!--
Expand Down Expand Up @@ -1182,6 +1194,7 @@
</bean>

<ref bean="cleanImport"/>
<ref bean="wrapX509Certificates"/>
<ref bean="stripAAMDUI"/>
<ref bean="stripMDUILogoHttp"/>
<ref bean="trimImportElementWhitespace"/>
Expand Down
15 changes: 0 additions & 15 deletions mdx/uk/import.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"
xmlns:ukfedlabel="http://ukfederation.org.uk/2006/11/label"

xmlns:mdxTextUtils="xalan://uk.ac.sdss.xalan.md.TextUtils"
extension-element-prefixes="mdxTextUtils"

xmlns:xalan="http://xml.apache.org/xalan"

exclude-result-prefixes="idpdisc init md mdui xalan"
Expand Down Expand Up @@ -261,18 +258,6 @@
</xsl:template>


<!--
Normalise whitespace in X509Certificate elements.
-->
<xsl:template match="ds:X509Certificate">
<xsl:element name="ds:X509Certificate">
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="mdxTextUtils:wrapBase64(.)"/>
<xsl:text>&#10;</xsl:text>
</xsl:element>
</xsl:template>


<!--
Discard ds:X509SubjectName
-->
Expand Down
3 changes: 3 additions & 0 deletions mdx/uk/verbs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@
</property>
</bean>

<!-- Normalise the text in ds:X509Certificate elements. -->
<ref bean="wrapX509Certificates"/>

<!-- normalise namespaces in a specific way -->
<bean id="normalizeFragment" parent="mda.XSLTransformationStage"
p:XSLResource="classpath:uk/ns_norm_fragment.xsl"/>
Expand Down

0 comments on commit a88a38f

Please sign in to comment.