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 4bf2292fd75 CAMEL-20231: make generators configurable (#1042) 4bf2292fd75 is described below commit 4bf2292fd7559ad2dd6b915c5226e5e66cd729da Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Dec 13 15:22:24 2023 +0100 CAMEL-20231: make generators configurable (#1042) --- .../camel-jasypt-starter/src/main/docs/jasypt.json | 64 +++++++++++++++++++++- .../JasyptEncryptedPropertiesConfiguration.java | 11 +--- .../src/test/resources/application.properties | 2 - 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/components-starter/camel-jasypt-starter/src/main/docs/jasypt.json b/components-starter/camel-jasypt-starter/src/main/docs/jasypt.json index da5f5f24116..120b69ccccf 100644 --- a/components-starter/camel-jasypt-starter/src/main/docs/jasypt.json +++ b/components-starter/camel-jasypt-starter/src/main/docs/jasypt.json @@ -1,3 +1,65 @@ { - "properties": [] + "groups": [ + { + "name": "camel.component.jasypt", + "type": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration" + } + ], + "properties": [ + { + "name": "camel.component.jasypt.algorithm", + "type": "java.lang.String", + "description": "The algorithm to be used for decryption. Default: PBEWithMD5AndDES", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration", + "defaultValue": "PBEWithMD5AndDES" + }, + { + "name": "camel.component.jasypt.enabled", + "type": "java.lang.Boolean", + "description": "Enable the component", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration", + "defaultValue": false + }, + { + "name": "camel.component.jasypt.iv-generator-class-name", + "type": "java.lang.String", + "description": "The initialization vector (IV) generator applied in decryption operations. Default: org.jasypt.iv.", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration" + }, + { + "name": "camel.component.jasypt.password", + "type": "java.lang.String", + "description": "The master password used by Jasypt for decrypting the values. This option supports prefixes which influence the master password lookup behaviour: sysenv: means to lookup the OS system environment with the given key. sys: means to lookup a JVM system property.", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration" + }, + { + "name": "camel.component.jasypt.provider-name", + "type": "java.lang.String", + "description": "The class name of the security provider to be used for obtaining the encryption algorithm.", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration" + }, + { + "name": "camel.component.jasypt.random-iv-generator-algorithm", + "type": "java.lang.String", + "description": "The algorithm for the random iv generator", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration", + "defaultValue": "SHA1PRNG" + }, + { + "name": "camel.component.jasypt.random-salt-generator-algorithm", + "type": "java.lang.String", + "description": "The algorithm for the salt generator", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration", + "defaultValue": "SHA1PRNG" + }, + { + "name": "camel.component.jasypt.salt-generator-class-name", + "type": "java.lang.String", + "description": "The salt generator applied in decryption operations. Default: org.jasypt.salt.RandomSaltGenerator", + "sourceType": "org.apache.camel.component.jasypt.springboot.JasyptEncryptedPropertiesConfiguration", + "defaultValue": "org.jasypt.salt.RandomSaltGenerator" + } + ], + "hints": [] } \ No newline at end of file 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 f73d8a444c9..e7e94c606ab 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 @@ -16,8 +16,9 @@ */ package org.apache.camel.component.jasypt.springboot; -import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +@ConfigurationProperties(prefix = "camel.component.jasypt") public class JasyptEncryptedPropertiesConfiguration { static final String PREFIX = "camel.component.jasypt"; @@ -25,13 +26,11 @@ public class JasyptEncryptedPropertiesConfiguration { /** * Enable the component */ - @Value("${camel.component.jasypt.enabled}") private boolean enabled; /** * The algorithm to be used for decryption. Default: PBEWithMD5AndDES */ - @Value("${camel.component.jasypt.algorithm}") private String algorithm = "PBEWithMD5AndDES"; /** @@ -40,39 +39,33 @@ public class JasyptEncryptedPropertiesConfiguration { * sysenv: means to lookup the OS system environment with the given key. * sys: means to lookup a JVM system property. */ - @Value("${camel.component.jasypt.password}") private String password; /** * The initialization vector (IV) generator applied in decryption operations. * Default: org.jasypt.iv. */ - @Value("${camel.component.jasypt.iv-generator-class-name}") private String ivGeneratorClassName; /** * The salt generator applied in decryption operations. Default: org.jasypt.salt.RandomSaltGenerator */ - @Value("${camel.component.jasypt.salt-generator-class-name}") private String saltGeneratorClassName = "org.jasypt.salt.RandomSaltGenerator"; /** * The algorithm for the random iv generator */ - @Value("${camel.component.jasypt.random-iv-generator-algorithm}") private String randomIvGeneratorAlgorithm = "SHA1PRNG"; /** * The algorithm for the salt generator */ - @Value("${camel.component.jasypt.random-salt-generator-algorithm}") private String randomSaltGeneratorAlgorithm = "SHA1PRNG"; /** * The class name of the security provider to be used for obtaining the encryption * algorithm. */ - @Value("${camel.component.jasypt.provider-name}") private String providerName; public boolean isEnabled() { diff --git a/components-starter/camel-jasypt-starter/src/test/resources/application.properties b/components-starter/camel-jasypt-starter/src/test/resources/application.properties index bc777df61db..54b2e8a1488 100644 --- a/components-starter/camel-jasypt-starter/src/test/resources/application.properties +++ b/components-starter/camel-jasypt-starter/src/test/resources/application.properties @@ -29,6 +29,4 @@ camel.component.jasypt.algorithm= PBEWITHHMACSHA256ANDAES_256 camel.component.jasypt.password = sys:JASYPT_ENCRYPTION_PASSWORD camel.component.jasypt.iv-generator-class-name = org.jasypt.iv.RandomIvGenerator camel.component.jasypt.salt-generator-class-name = org.jasypt.salt.RandomSaltGenerator -camel.component.jasypt.random-iv-generator-algorithm = SHA1PRNG -camel.component.jasypt.random-salt-generator-algorithm = SHA1PRNG camel.component.jasypt.provider-name = SunJCE