You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/12/12 12:15:30 UTC

(camel-spring-boot) branch CAMEL-20223 created (now bcf16365ebb)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch CAMEL-20223
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


      at bcf16365ebb CAMEL-20223 - Camel-Spring-Boot: Camel Azure Key Vault should Support Azure Identity in the component and secrets function

This branch includes the following new commits:

     new bcf16365ebb CAMEL-20223 - Camel-Spring-Boot: Camel Azure Key Vault should Support Azure Identity in the component and secrets function

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel-spring-boot) 01/01: CAMEL-20223 - Camel-Spring-Boot: Camel Azure Key Vault should Support Azure Identity in the component and secrets function

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-20223
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit bcf16365ebb7556419b9ceface006d566556989a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Dec 12 13:14:51 2023 +0100

    CAMEL-20223 - Camel-Spring-Boot: Camel Azure Key Vault should Support Azure Identity in the component and secrets function
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../springboot/catalog/components/azure-key-vault.json | 13 +++++++------
 core/camel-spring-boot/src/main/docs/spring-boot.json  |  7 +++++++
 .../spring/boot/vault/AzureVaultAutoConfiguration.java |  1 +
 .../boot/vault/AzureVaultConfigurationProperties.java  | 18 ++++++++++++++++--
 .../spring/boot/vault/AzureVaultConfigurationTest.java |  4 +++-
 5 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/azure-key-vault.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/azure-key-vault.json
index 6e16812971f..480370934fd 100644
--- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/azure-key-vault.json
+++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/azure-key-vault.json
@@ -31,11 +31,12 @@
   },
   "properties": {
     "vaultName": { "index": 0, "kind": "path", "displayName": "Vault Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Vault Name to be used" },
-    "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.key.vault.KeyVaultOperation", "enum": [ "createSecret", "getSecret", "deleteSecret", "purgeDeletedSecret" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configu [...]
-    "secretClient": { "index": 2, "kind": "parameter", "displayName": "Secret Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.azure.security.keyvault.secrets.SecretClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Instance of Secret client" },
-    "lazyStartProducer": { "index": 3, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...]
-    "clientId": { "index": 4, "kind": "parameter", "displayName": "Client Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Id to be used" },
-    "clientSecret": { "index": 5, "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Secret to be used" },
-    "tenantId": { "index": 6, "kind": "parameter", "displayName": "Tenant Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Tenant Id to be used" }
+    "credentialType": { "index": 1, "kind": "parameter", "displayName": "Credential Type", "group": "common", "label": "common", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.key.vault.CredentialType", "enum": [ "CLIENT_SECRET", "AZURE_IDENTITY" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "CLIENT_SECRET", "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "co [...]
+    "operation": { "index": 2, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.key.vault.KeyVaultOperation", "enum": [ "createSecret", "getSecret", "deleteSecret", "purgeDeletedSecret" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configu [...]
+    "secretClient": { "index": 3, "kind": "parameter", "displayName": "Secret Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.azure.security.keyvault.secrets.SecretClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Instance of Secret client" },
+    "lazyStartProducer": { "index": 4, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...]
+    "clientId": { "index": 5, "kind": "parameter", "displayName": "Client Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Id to be used" },
+    "clientSecret": { "index": 6, "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Secret to be used" },
+    "tenantId": { "index": 7, "kind": "parameter", "displayName": "Tenant Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Tenant Id to be used" }
   }
 }
diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json b/core/camel-spring-boot/src/main/docs/spring-boot.json
index 0db136bc244..594f8f9298b 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -1606,6 +1606,13 @@
       "description": "Define the secrets to look at",
       "sourceType": "org.apache.camel.spring.boot.vault.AwsVaultConfigurationProperties"
     },
+    {
+      "name": "camel.vault.azure.azure-identity-enabled",
+      "type": "java.lang.Boolean",
+      "description": "Whether the Azure Identity Authentication should be used or not.",
+      "sourceType": "org.apache.camel.spring.boot.vault.AzureVaultConfigurationProperties",
+      "defaultValue": false
+    },
     {
       "name": "camel.vault.azure.blob-access-key",
       "type": "java.lang.String",
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java
index 16621be1e6e..3524f565f9a 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java
@@ -37,6 +37,7 @@ public class AzureVaultAutoConfiguration {
         answer.setClientSecret(config.getClientSecret());
         answer.setVaultName(config.getVaultName());
         answer.setTenantId(config.getTenantId());
+        answer.setAzureIdentityEnabled(config.isAzureIdentityEnabled());
         answer.setRefreshEnabled(config.isRefreshEnabled());
         answer.setRefreshPeriod(config.getRefreshPeriod());
         answer.setSecrets(config.getSecrets());
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationProperties.java
index 492611bec93..329947360fc 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationProperties.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationProperties.java
@@ -41,7 +41,13 @@ public class AzureVaultConfigurationProperties {
      * The tenant Id
      */
     private String tenantId;
-    
+
+
+    /**
+     * Whether the Azure Identity Authentication should be used or not.
+     */
+    private boolean azureIdentityEnabled;
+
     /**
      * Whether to automatically reload Camel upon secrets being updated in Azure.
      */
@@ -108,7 +114,15 @@ public class AzureVaultConfigurationProperties {
     public void setTenantId(String tenantId) {
         this.tenantId = tenantId;
     }
-    
+
+    public boolean isAzureIdentityEnabled() {
+        return azureIdentityEnabled;
+    }
+
+    public void setAzureIdentityEnabled(boolean azureIdentityEnabled) {
+        this.azureIdentityEnabled = azureIdentityEnabled;
+    }
+
     public boolean isRefreshEnabled() {
         return refreshEnabled;
     }
diff --git a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java
index d42c964aec0..d0746694ddd 100644
--- a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java
+++ b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java
@@ -36,7 +36,8 @@ import org.springframework.test.annotation.DirtiesContext;
                 "camel.vault.azure.clientId=myClientId",
                 "camel.vault.azure.clientSecret=myClientSecret",
                 "camel.vault.azure.tenantId=myTenantId",
-                "camel.vault.azure.eventhubConnectionString=connString"}
+                "camel.vault.azure.eventhubConnectionString=connString",
+                "camel.vault.azure.azureIdentityEnabled=true",}
 )
 public class AzureVaultConfigurationTest {
 
@@ -50,5 +51,6 @@ public class AzureVaultConfigurationTest {
         Assertions.assertEquals("myClientId", camelContext.getVaultConfiguration().azure().getClientId());
         Assertions.assertEquals("myTenantId", camelContext.getVaultConfiguration().azure().getTenantId());
         Assertions.assertEquals("connString", camelContext.getVaultConfiguration().azure().getEventhubConnectionString());
+        Assertions.assertEquals(true, camelContext.getVaultConfiguration().azure().isAzureIdentityEnabled());
     }
 }