This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch 17686-sb in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit fadef7fa228333f0ca7f3218a19b06dbd25935f2 Author: Andrea Cosentino <[email protected]> AuthorDate: Mon Apr 4 10:58:52 2022 +0200 CAMEL-17686 - Support ability to load properties from Vault/Secrets cloud services - Azure Key Vault --- .../boot/vault/AzureVaultAutoConfiguration.java | 44 +++++++++++++ .../vault/AzureVaultConfigurationProperties.java | 75 ++++++++++++++++++++++ .../src/main/resources/META-INF/spring.factories | 3 +- 3 files changed, 121 insertions(+), 1 deletion(-) 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 new file mode 100644 index 00000000000..228a098890d --- /dev/null +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.boot.vault; + +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.vault.AwsVaultConfiguration; +import org.apache.camel.vault.AzureVaultConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration(proxyBeanMethods = false) +@ConditionalOnBean(CamelAutoConfiguration.class) +@EnableConfigurationProperties(AzureVaultConfigurationProperties.class) +@AutoConfigureAfter(CamelAutoConfiguration.class) +public class AzureVaultAutoConfiguration { + + @Bean + public AzureVaultConfiguration azureVaultConfiguration(AzureVaultConfigurationProperties config) { + AzureVaultConfiguration answer = new AzureVaultConfiguration(); + answer.setClientId(config.getClientId()); + answer.setClientSecret(config.getClientSecret()); + answer.setVaultName(config.getVaultName()); + answer.setTenantId(config.getTenantId()); + 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 new file mode 100644 index 00000000000..e44bf4dcca7 --- /dev/null +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationProperties.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.boot.vault; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "camel.vault.azure") +public class AzureVaultConfigurationProperties { + + /** + * The Vault Name + */ + private String vaultName; + + /** + * The Client Id + */ + private String clientId; + + /** + * The Client secret + */ + private String clientSecret; + + /** + * The tenant Id + */ + private String tenantId; + + public String getVaultName() { + return vaultName; + } + + public void setVaultName(String vaultName) { + this.vaultName = vaultName; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } +} diff --git a/core/camel-spring-boot/src/main/resources/META-INF/spring.factories b/core/camel-spring-boot/src/main/resources/META-INF/spring.factories index f1b6afcc77a..5b32d258ad4 100644 --- a/core/camel-spring-boot/src/main/resources/META-INF/spring.factories +++ b/core/camel-spring-boot/src/main/resources/META-INF/spring.factories @@ -48,5 +48,6 @@ org.apache.camel.spring.boot.security.CamelSSLAutoConfiguration,\ org.apache.camel.spring.boot.threadpool.CamelThreadPoolAutoConfiguration,\ org.apache.camel.spring.boot.routetemplate.CamelRouteTemplateAutoConfiguration,\ org.apache.camel.spring.boot.vault.AwsVaultAutoConfiguration, \ -org.apache.camel.spring.boot.vault.GcpVaultAutoConfiguration +org.apache.camel.spring.boot.vault.GcpVaultAutoConfiguration, \ +org.apache.camel.spring.boot.vault.AzureVaultAutoConfiguration
