You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/02/06 09:54:55 UTC
[camel] branch master updated: camel3 - Fixed todo in XML DSL -
Rename attribute on data format
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 28f83a4 camel3 - Fixed todo in XML DSL - Rename attribute on <secureXML> data format
28f83a4 is described below
commit 28f83a4ba40371bd8d2fafa5efaf922cff61f8da
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Feb 6 10:54:34 2019 +0100
camel3 - Fixed todo in XML DSL - Rename attribute on <secureXML> data format
---
MIGRATION.md | 2 ++
.../src/main/docs/secureXML-dataformat.adoc | 6 ++--
.../xmlsecurity/XMLSecurityDataFormat.java | 34 +++++++++++-----------
.../SpringXmlSecurityDataFormatTest-context.xml | 4 +--
...curityDataFormatWithKeyPasswordTest-context.xml | 4 +--
.../org/apache/camel/builder/DataFormatClause.java | 8 ++---
.../model/dataformat/XMLSecurityDataFormat.java | 15 +++++-----
.../XMLSecurityDataFormatConfiguration.java | 12 ++++----
8 files changed, 43 insertions(+), 42 deletions(-)
diff --git a/MIGRATION.md b/MIGRATION.md
index d1f46bb..d2ad98c 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -123,3 +123,5 @@ The class `XsltAggregationStrategy` has been moved from `org.apache.camel.builde
The XML DSL has been changed slightly.
The custom load balancer EIP has changed from `<custom>` to `<customLoadBalancer>`
+
+The XMLSecurity data format has renamed the attribute `keyOrTrustStoreParametersId` to `keyOrTrustStoreParametersRef` in the `<secureXML>` tag.
\ No newline at end of file
diff --git a/components/camel-xmlsecurity/src/main/docs/secureXML-dataformat.adoc b/components/camel-xmlsecurity/src/main/docs/secureXML-dataformat.adoc
index ac7885b..a1f6c7a 100644
--- a/components/camel-xmlsecurity/src/main/docs/secureXML-dataformat.adoc
+++ b/components/camel-xmlsecurity/src/main/docs/secureXML-dataformat.adoc
@@ -53,7 +53,7 @@ The XML Security dataformat supports 13 options, which are listed below.
| secureTagContents | false | Boolean | A boolean value to specify whether the XML Element is to be encrypted or the contents of the XML Element false = Element Level true = Element Content Level
| keyCipherAlgorithm | RSA_OAEP | String | The cipher algorithm to be used for encryption/decryption of the asymmetric key. The available choices are: XMLCipher.RSA_v1dot5 XMLCipher.RSA_OAEP XMLCipher.RSA_OAEP_11 The default value is XMLCipher.RSA_OAEP
| recipientKeyAlias | | String | The key alias to be used when retrieving the recipient's public or private key from a KeyStore when performing asymmetric key encryption or decryption.
-| keyOrTrustStoreParametersId | | String | Refers to a KeyStore instance to lookup in the registry, which is used for configuration options for creating and loading a KeyStore instance that represents the sender's trustStore or recipient's keyStore.
+| keyOrTrustStoreParametersRef | | String | Refers to a KeyStore instance to lookup in the registry, which is used for configuration options for creating and loading a KeyStore instance that represents the sender's trustStore or recipient's keyStore.
| keyPassword | | String | The password to be used for retrieving the private key from the KeyStore. This key is used for asymmetric decryption.
| digestAlgorithm | SHA1 | String | The digest algorithm to use with the RSA OAEP algorithm. The available choices are: XMLCipher.SHA1 XMLCipher.SHA256 XMLCipher.SHA512 The default value is XMLCipher.SHA1
| mgfAlgorithm | MGF1_SHA1 | String | The MGF Algorithm to use with the RSA OAEP algorithm. The available choices are: EncryptionConstants.MGF1_SHA1 EncryptionConstants.MGF1_SHA256 EncryptionConstants.MGF1_SHA512 The default value is EncryptionConstants.MGF1_SHA1
@@ -218,7 +218,7 @@ Spring XML Sender
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
recipientKeyAlias="recipient"
- keyOrTrustStoreParametersId="trustStoreParams"/>
+ keyOrTrustStoreParametersRef="trustStoreParams"/>
</marshal>
...
--------------------------------------------------------------------------------------------------
@@ -243,7 +243,7 @@ Spring XML Recipient
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
recipientKeyAlias="recipient"
- keyOrTrustStoreParametersId="keyStoreParams"
+ keyOrTrustStoreParametersRef="keyStoreParams"
keyPassword="privateKeyPassword" />
</unmarshal>
...
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
index c8bd3e1..deab7b7 100644
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
@@ -102,7 +102,7 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
private String keyPassword;
private KeyStoreParameters keyOrTrustStoreParameters;
- private String keyOrTrustStoreParametersId;
+ private String keyOrTrustStoreParametersRef;
private CamelContext camelContext;
private DefaultNamespaceContext nsContext = new DefaultNamespaceContext();
@@ -187,30 +187,30 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
}
public XMLSecurityDataFormat(String secureTag, boolean secureTagContents, String recipientKeyAlias,
- String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersId) {
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersRef) {
this();
this.setSecureTag(secureTag);
this.setSecureTagContents(secureTagContents);
this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
this.setRecipientKeyAlias(recipientKeyAlias);
this.setKeyCipherAlgorithm(keyCipherAlgorithm);
- this.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ this.setKeyOrTrustStoreParametersRef(keyOrTrustStoreParametersRef);
}
public XMLSecurityDataFormat(String secureTag, boolean secureTagContents, String recipientKeyAlias,
- String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersId, String keyPassword) {
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersRef, String keyPassword) {
this();
this.setSecureTag(secureTag);
this.setSecureTagContents(secureTagContents);
this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
this.setRecipientKeyAlias(recipientKeyAlias);
this.setKeyCipherAlgorithm(keyCipherAlgorithm);
- this.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ this.setKeyOrTrustStoreParametersRef(keyOrTrustStoreParametersRef);
this.setKeyPassword(keyPassword);
}
public XMLSecurityDataFormat(String secureTag, Map<String, String> namespaces, boolean secureTagContents, String recipientKeyAlias,
- String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersId) {
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersRef) {
this();
this.setSecureTag(secureTag);
this.setSecureTagContents(secureTagContents);
@@ -218,13 +218,13 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
this.setRecipientKeyAlias(recipientKeyAlias);
this.setKeyCipherAlgorithm(keyCipherAlgorithm);
this.setNamespaces(namespaces);
- if (null != keyOrTrustStoreParametersId && !keyOrTrustStoreParametersId.equals("")) {
- this.keyOrTrustStoreParametersId = keyOrTrustStoreParametersId;
+ if (null != keyOrTrustStoreParametersRef && !keyOrTrustStoreParametersRef.equals("")) {
+ this.keyOrTrustStoreParametersRef = keyOrTrustStoreParametersRef;
}
}
public XMLSecurityDataFormat(String secureTag, Map<String, String> namespaces, boolean secureTagContents, String recipientKeyAlias,
- String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersId, String keyPassword) {
+ String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersRef, String keyPassword) {
this();
this.setSecureTag(secureTag);
this.setSecureTagContents(secureTagContents);
@@ -232,8 +232,8 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
this.setRecipientKeyAlias(recipientKeyAlias);
this.setKeyCipherAlgorithm(keyCipherAlgorithm);
this.setNamespaces(namespaces);
- if (null != keyOrTrustStoreParametersId && !keyOrTrustStoreParametersId.equals("")) {
- this.keyOrTrustStoreParametersId = keyOrTrustStoreParametersId;
+ if (null != keyOrTrustStoreParametersRef && !keyOrTrustStoreParametersRef.equals("")) {
+ this.keyOrTrustStoreParametersRef = keyOrTrustStoreParametersRef;
}
this.setKeyPassword(keyPassword);
}
@@ -889,22 +889,22 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
return this.keyOrTrustStoreParameters;
}
- public void setKeyOrTrustStoreParametersId(String registryId) {
- this.keyOrTrustStoreParametersId = registryId;
+ public void setKeyOrTrustStoreParametersRef(String registryId) {
+ this.keyOrTrustStoreParametersRef = registryId;
if (camelContext != null) {
- Object parametersObj = camelContext.getRegistry().lookupByName(this.keyOrTrustStoreParametersId);
+ Object parametersObj = camelContext.getRegistry().lookupByName(this.keyOrTrustStoreParametersRef);
if (parametersObj instanceof KeyStoreParameters) {
this.keyOrTrustStoreParameters = (KeyStoreParameters)parametersObj;
} else {
throw new IllegalStateException("Could not initialize XMLSecurityDataFormat with camelContext."
- + "The id for the keyOrTrustStoreParameters specified [ " + keyOrTrustStoreParametersId
+ + "The id for the keyOrTrustStoreParameters specified [ " + keyOrTrustStoreParametersRef
+ " ] does not identify a KeyStoreParameters bean.");
}
}
}
- public String getKeyOrTrustStoreParametersId() {
- return this.keyOrTrustStoreParametersId;
+ public String getKeyOrTrustStoreParametersRef() {
+ return this.keyOrTrustStoreParametersRef;
}
public void setNamespaces(Map<String, String> namespaces) {
diff --git a/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatTest-context.xml b/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatTest-context.xml
index 6a65abc..2256b7b 100644
--- a/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatTest-context.xml
+++ b/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatTest-context.xml
@@ -47,7 +47,7 @@
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
recipientKeyAlias="recipient"
- keyOrTrustStoreParametersId="trustStoreParams" />
+ keyOrTrustStoreParametersRef="trustStoreParams" />
</marshal>
<to uri="mock:encrypted"/>
<to uri="direct://encrypted"/>
@@ -61,7 +61,7 @@
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
recipientKeyAlias="recipient"
- keyOrTrustStoreParametersId="keyStoreParams" />
+ keyOrTrustStoreParametersRef="keyStoreParams" />
</unmarshal>
<to uri="mock://decrypted"/>
</route>
diff --git a/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml b/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
index c06b59e..3a11c57 100644
--- a/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
+++ b/components/camel-xmlsecurity/src/test/resources/org/apache/camel/dataformat/xmlsecurity/SpringXmlSecurityDataFormatWithKeyPasswordTest-context.xml
@@ -47,7 +47,7 @@
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
recipientKeyAlias="recipient"
- keyOrTrustStoreParametersId="trustStoreParams" />
+ keyOrTrustStoreParametersRef="trustStoreParams" />
</marshal>
<to uri="mock:encrypted"/>
<to uri="direct://encrypted"/>
@@ -61,7 +61,7 @@
xmlCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"
keyCipherAlgorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"
recipientKeyAlias="recipient"
- keyOrTrustStoreParametersId="keyStoreParams"
+ keyOrTrustStoreParametersRef="keyStoreParams"
keyPassword="keyPassword"/>
</unmarshal>
<to uri="mock://decrypted"/>
diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index 70d7f5d..df8d130 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -1065,7 +1065,7 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
xsdf.setRecipientKeyAlias(recipientKeyAlias);
xsdf.setXmlCipherAlgorithm(xmlCipherAlgorithm);
xsdf.setKeyCipherAlgorithm(keyCipherAlgorithm);
- xsdf.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ xsdf.setKeyOrTrustStoreParametersRef(keyOrTrustStoreParametersId);
return dataFormat(xsdf);
}
@@ -1080,7 +1080,7 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
xsdf.setRecipientKeyAlias(recipientKeyAlias);
xsdf.setXmlCipherAlgorithm(xmlCipherAlgorithm);
xsdf.setKeyCipherAlgorithm(keyCipherAlgorithm);
- xsdf.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ xsdf.setKeyOrTrustStoreParametersRef(keyOrTrustStoreParametersId);
xsdf.setKeyPassword(keyPassword);
return dataFormat(xsdf);
}
@@ -1127,7 +1127,7 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
xsdf.setRecipientKeyAlias(recipientKeyAlias);
xsdf.setXmlCipherAlgorithm(xmlCipherAlgorithm);
xsdf.setKeyCipherAlgorithm(keyCipherAlgorithm);
- xsdf.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ xsdf.setKeyOrTrustStoreParametersRef(keyOrTrustStoreParametersId);
return dataFormat(xsdf);
}
@@ -1142,7 +1142,7 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
xsdf.setRecipientKeyAlias(recipientKeyAlias);
xsdf.setXmlCipherAlgorithm(xmlCipherAlgorithm);
xsdf.setKeyCipherAlgorithm(keyCipherAlgorithm);
- xsdf.setKeyOrTrustStoreParametersId(keyOrTrustStoreParametersId);
+ xsdf.setKeyOrTrustStoreParametersRef(keyOrTrustStoreParametersId);
xsdf.setKeyPassword(keyPassword);
return dataFormat(xsdf);
}
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
index 7f63e67..ceaceba 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
@@ -57,8 +57,7 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
@XmlAttribute
private String recipientKeyAlias;
@XmlAttribute
- // TODO: rename to keyOrTrustStoreParametersRef
- private String keyOrTrustStoreParametersId;
+ private String keyOrTrustStoreParametersRef;
@XmlAttribute
private String keyPassword;
@XmlAttribute @Metadata(defaultValue = "SHA1")
@@ -107,8 +106,8 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
if (getRecipientKeyAlias() != null) {
setProperty(camelContext, dataFormat, "recipientKeyAlias", getRecipientKeyAlias());
}
- if (getKeyOrTrustStoreParametersId() != null) {
- setProperty(camelContext, dataFormat, "keyOrTrustStoreParametersId", getKeyOrTrustStoreParametersId());
+ if (getKeyOrTrustStoreParametersRef() != null) {
+ setProperty(camelContext, dataFormat, "keyOrTrustStoreParametersRef", getKeyOrTrustStoreParametersRef());
}
if (keyOrTrustStoreParameters != null) {
setProperty(camelContext, dataFormat, "keyOrTrustStoreParameters", this.keyOrTrustStoreParameters);
@@ -239,12 +238,12 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
* Refers to a KeyStore instance to lookup in the registry, which is used for
* configuration options for creating and loading a KeyStore instance that represents the sender's trustStore or recipient's keyStore.
*/
- public void setKeyOrTrustStoreParametersId(String id) {
- this.keyOrTrustStoreParametersId = id;
+ public void setKeyOrTrustStoreParametersRef(String id) {
+ this.keyOrTrustStoreParametersRef = id;
}
- public String getKeyOrTrustStoreParametersId() {
- return this.keyOrTrustStoreParametersId;
+ public String getKeyOrTrustStoreParametersRef() {
+ return this.keyOrTrustStoreParametersRef;
}
public KeyStoreParameters getKeyOrTrustStoreParameters() {
diff --git a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java
index 2b437f2..07e2d71 100644
--- a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatConfiguration.java
@@ -92,7 +92,7 @@ public class XMLSecurityDataFormatConfiguration
* for configuration options for creating and loading a KeyStore instance
* that represents the sender's trustStore or recipient's keyStore.
*/
- private String keyOrTrustStoreParametersId;
+ private String keyOrTrustStoreParametersRef;
/**
* The password to be used for retrieving the private key from the KeyStore.
* This key is used for asymmetric decryption.
@@ -180,13 +180,13 @@ public class XMLSecurityDataFormatConfiguration
this.recipientKeyAlias = recipientKeyAlias;
}
- public String getKeyOrTrustStoreParametersId() {
- return keyOrTrustStoreParametersId;
+ public String getKeyOrTrustStoreParametersRef() {
+ return keyOrTrustStoreParametersRef;
}
- public void setKeyOrTrustStoreParametersId(
- String keyOrTrustStoreParametersId) {
- this.keyOrTrustStoreParametersId = keyOrTrustStoreParametersId;
+ public void setKeyOrTrustStoreParametersRef(
+ String keyOrTrustStoreParametersRef) {
+ this.keyOrTrustStoreParametersRef = keyOrTrustStoreParametersRef;
}
public String getKeyPassword() {