CAMEL-18518 - Support Secrets Reload from Vault/Cloud Service in camel-spring-boot - Azure Key Vault

Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
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 e9cc039..16621be 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,13 @@
         answer.setClientSecret(config.getClientSecret());
         answer.setVaultName(config.getVaultName());
         answer.setTenantId(config.getTenantId());
+        answer.setRefreshEnabled(config.isRefreshEnabled());
+        answer.setRefreshPeriod(config.getRefreshPeriod());
+        answer.setSecrets(config.getSecrets());
+        answer.setEventhubConnectionString(config.getEventhubConnectionString());
+        answer.setBlobAccessKey(config.getBlobAccessKey());
+        answer.setBlobAccountName(config.getBlobAccountName());
+        answer.setBlobContainerName(config.getBlobContainerName());
         return answer;
     }
 
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 e44bf4d..492611b 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
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.spring.boot.vault;
 
+import org.apache.camel.spi.Metadata;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 @ConfigurationProperties(prefix = "camel.vault.azure")
@@ -40,6 +41,41 @@
      * The tenant Id
      */
     private String tenantId;
+    
+    /**
+     * Whether to automatically reload Camel upon secrets being updated in Azure.
+     */
+    private boolean refreshEnabled;
+    
+    /**
+     * The period (millis) between checking Azure for updated secrets.
+     */
+    private long refreshPeriod = 30000;
+    
+    /**
+     * Specify the secret names (or pattern) to check for updates. Multiple secrets can be separated by comma.
+     */
+    private String secrets;
+    
+    /**
+     * The Eventhubs connection String for Key Vault Secret events notifications
+     */
+    private String eventhubConnectionString;
+
+    /**
+     * The Eventhubs Blob Access Key for CheckpointStore purpose
+     */
+    private String blobAccessKey;
+
+    /**
+     * The Eventhubs Blob Account Name for CheckpointStore purpose
+     */
+    private String blobAccountName;
+
+    /**
+     * The Eventhubs Blob Container Name for CheckpointStore purpose
+     */
+    private String blobContainerName;
 
     public String getVaultName() {
         return vaultName;
@@ -72,4 +108,60 @@
     public void setTenantId(String tenantId) {
         this.tenantId = tenantId;
     }
+    
+    public boolean isRefreshEnabled() {
+        return refreshEnabled;
+    }
+
+    public void setRefreshEnabled(boolean refreshEnabled) {
+        this.refreshEnabled = refreshEnabled;
+    }
+
+    public long getRefreshPeriod() {
+        return refreshPeriod;
+    }
+
+    public void setRefreshPeriod(long refreshPeriod) {
+        this.refreshPeriod = refreshPeriod;
+    }
+
+    public String getSecrets() {
+        return secrets;
+    }
+
+    public void setSecrets(String secrets) {
+        this.secrets = secrets;
+    }
+
+    public String getEventhubConnectionString() {
+        return eventhubConnectionString;
+    }
+
+    public void setEventhubConnectionString(String eventhubConnectionString) {
+        this.eventhubConnectionString = eventhubConnectionString;
+    }
+
+    public String getBlobAccessKey() {
+        return blobAccessKey;
+    }
+
+    public void setBlobAccessKey(String blobAccessKey) {
+        this.blobAccessKey = blobAccessKey;
+    }
+
+    public String getBlobAccountName() {
+        return blobAccountName;
+    }
+
+    public void setBlobAccountName(String blobAccountName) {
+        this.blobAccountName = blobAccountName;
+    }
+
+    public String getBlobContainerName() {
+        return blobContainerName;
+    }
+
+    public void setBlobContainerName(String blobContainerName) {
+        this.blobContainerName = blobContainerName;
+    }
 }
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 d583443..d42c964 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
@@ -35,7 +35,8 @@
                 "camel.vault.azure.vaultName=myVault",
                 "camel.vault.azure.clientId=myClientId",
                 "camel.vault.azure.clientSecret=myClientSecret",
-                "camel.vault.azure.tenantId=myTenantId"}
+                "camel.vault.azure.tenantId=myTenantId",
+                "camel.vault.azure.eventhubConnectionString=connString"}
 )
 public class AzureVaultConfigurationTest {
 
@@ -48,5 +49,6 @@
         Assertions.assertEquals("myClientSecret", camelContext.getVaultConfiguration().azure().getClientSecret());
         Assertions.assertEquals("myClientId", camelContext.getVaultConfiguration().azure().getClientId());
         Assertions.assertEquals("myTenantId", camelContext.getVaultConfiguration().azure().getTenantId());
+        Assertions.assertEquals("connString", camelContext.getVaultConfiguration().azure().getEventhubConnectionString());
     }
 }