Author: anil.saldhana(a)jboss.com
Date: 2010-06-30 18:42:29 -0400 (Wed, 30 Jun 2010)
New Revision: 324
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java
Log:
PLFED-91: make the canonicalization method configurable via system property
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java 2010-06-30
22:33:58 UTC (rev 323)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/XMLSignatureUtil.java 2010-06-30
22:42:29 UTC (rev 324)
@@ -72,6 +72,8 @@
/**
* Utility for XML Signature
+ * <b>Note:</b> You can change the canonicalization method type by using
+ * the system property "picketlink.xmlsig.canonicalization"
* @author Anil.Saldhana(a)redhat.com
* @since Dec 15, 2008
*/
@@ -81,7 +83,9 @@
private static boolean trace = log.isTraceEnabled();
private static String pkgName =
"org.picketlink.identity.federation.w3.xmldsig";
- private static String schemaLocation =
"schema/saml/v2/xmldsig-core-schema.xsd";
+ private static String schemaLocation =
"schema/saml/v2/xmldsig-core-schema.xsd";
+
+ private static String canonicalizationMethodType = null;
private static ObjectFactory objectFactory = new ObjectFactory();
@@ -112,12 +116,25 @@
public Object run()
{
System.setProperty("org.apache.xml.security.ignoreLineBreaks",
"true");
+
+ canonicalizationMethodType = System.getProperty(
"picketlink.xmlsig.canonicalization",
+ CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS );
return null;
}
});
};
/**
+ * Set the canonicalization method type
+ * @param canonical
+ */
+ public static void setCanonicalizationMethodType( String canonical )
+ {
+ if( canonical != null )
+ canonicalizationMethodType = canonical;
+ }
+
+ /**
* Precheck whether the document that will be validated
* has the right signedinfo
* @param doc
@@ -246,7 +263,6 @@
Reference ref = fac.newReference
( referenceURI, digestMethodObj,transformList,null, null);
- String canonicalizationMethodType = CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS;
CanonicalizationMethod canonicalizationMethod
= fac.newCanonicalizationMethod
(canonicalizationMethodType, (C14NMethodParameterSpec) null);
Show replies by date