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 2023/12/13 14:09:29 UTC
(camel-spring-boot) branch main updated: CAMEL-20231: make generators configurable (#1042)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 584168fe194 CAMEL-20231: make generators configurable (#1042)
584168fe194 is described below
commit 584168fe194c8110f362f65f21700b2b298088d0
Author: Federico Mariani <34...@users.noreply.github.com>
AuthorDate: Wed Dec 13 15:09:22 2023 +0100
CAMEL-20231: make generators configurable (#1042)
---
...JasyptEncryptedPropertiesAutoconfiguration.java | 4 +++-
.../JasyptEncryptedPropertiesConfiguration.java | 22 ++++++++++++++++++++++
.../springboot/JasyptEncryptedPropertiesUtils.java | 7 ++++++-
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesAutoconfiguration.java b/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesAutoconfiguration.java
index 6c299bb4f46..550195a85cd 100644
--- a/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesAutoconfiguration.java
+++ b/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesAutoconfiguration.java
@@ -116,6 +116,8 @@ public class JasyptEncryptedPropertiesAutoconfiguration {
if (saltGenerator != null) {
return saltGenerator;
}
- return new RandomSaltGenerator();
+
+ return configuration.getRandomSaltGeneratorAlgorithm() != null ?
+ new RandomSaltGenerator(configuration.getRandomSaltGeneratorAlgorithm()) : new RandomSaltGenerator();
}
}
diff --git a/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesConfiguration.java b/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesConfiguration.java
index b4e8a4811b0..7312bcfd731 100644
--- a/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesConfiguration.java
+++ b/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesConfiguration.java
@@ -56,6 +56,12 @@ public class JasyptEncryptedPropertiesConfiguration {
@Value("${camel.component.jasypt.salt-generator-class-name}")
private String saltGeneratorClassName = "org.jasypt.salt.RandomSaltGenerator";
+ @Value("${camel.component.jasypt.random-iv-generator-algorithm}")
+ private String randomIvGeneratorAlgorithm;
+
+ @Value("${camel.component.jasypt.random-salt-generator-algorithm}")
+ private String randomSaltGeneratorAlgorithm;
+
/**
* The class name of the security provider to be used for obtaining the encryption
* algorithm.
@@ -111,5 +117,21 @@ public class JasyptEncryptedPropertiesConfiguration {
public void setProviderName(String providerName) {
this.providerName = providerName;
}
+
+ public String getRandomIvGeneratorAlgorithm() {
+ return randomIvGeneratorAlgorithm;
+ }
+
+ public void setRandomIvGeneratorAlgorithm(String randomIvGeneratorAlgorithm) {
+ this.randomIvGeneratorAlgorithm = randomIvGeneratorAlgorithm;
+ }
+
+ public String getRandomSaltGeneratorAlgorithm() {
+ return randomSaltGeneratorAlgorithm;
+ }
+
+ public void setRandomSaltGeneratorAlgorithm(String randomSaltGeneratorAlgorithm) {
+ this.randomSaltGeneratorAlgorithm = randomSaltGeneratorAlgorithm;
+ }
}
diff --git a/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesUtils.java b/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesUtils.java
index 1289ae070c4..747435142de 100644
--- a/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesUtils.java
+++ b/components-starter/camel-jasypt-starter/src/main/java/org/apache/camel/component/jasypt/springboot/JasyptEncryptedPropertiesUtils.java
@@ -110,7 +110,12 @@ public class JasyptEncryptedPropertiesUtils {
String ivGeneratorClassName = configuration.getIvGeneratorClassName();
String algorithm = configuration.getAlgorithm();
if (isBlank(ivGeneratorClassName)) {
- return isIVNeeded(algorithm) ? new RandomIvGenerator() : new NoIvGenerator();
+ if (isIVNeeded(algorithm)) {
+ return configuration.getRandomIvGeneratorAlgorithm() != null ?
+ new RandomIvGenerator(configuration.getRandomIvGeneratorAlgorithm()) : new RandomIvGenerator();
+ } else {
+ return new NoIvGenerator();
+ }
}
IvGenerator ivGenerator = loadClass(ivGeneratorClassName);
return ivGenerator;