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/04/05 14:34:31 UTC

[camel] branch camel-3.x updated (802f3f422e4 -> c89bb81df27)

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

acosentino pushed a change to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 802f3f422e4 CAMEL-19250: Classes generated by camel-restdsl-openapi-plugin are not added to jar (#9820)
     new 12859a3ea0d CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
     new 61ed938fdb7 CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
     new ed49602f9b2 CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
     new b42a006077a CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
     new c89bb81df27 CAMEL-18625 - Provide an option to pass specific AWS SAML Profile

The 5 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.


Summary of changes:
 .../main/camel-main-configuration-metadata.json    |  2 +
 .../SecretsManagerPropertiesFunction.java          | 40 ++++++++++++++-
 .../apache/camel/vault/AwsVaultConfiguration.java  | 26 ++++++++++
 .../main/AwsVaultConfigurationConfigurer.java      | 12 +++++
 .../AwsVaultConfigurationPropertiesConfigurer.java | 12 +++++
 .../camel-main-configuration-metadata.json         |  2 +
 core/camel-main/src/main/docs/main.adoc            |  4 +-
 .../main/AwsVaultConfigurationProperties.java      | 16 ++++++
 .../java/org/apache/camel/main/MainVaultTest.java  | 59 ++++++++++++++++++++++
 9 files changed, 171 insertions(+), 2 deletions(-)


[camel] 04/05: CAMEL-18625 - Provide an option to pass specific AWS SAML Profile

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

acosentino pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b42a006077a637541a2628d0f3b59d40311a37df
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Apr 5 15:51:01 2023 +0200

    CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../SecretsManagerPropertiesFunction.java          | 40 +++++++++++++++++++++-
 .../SecretsManagerNoEnvPropertiesSourceTestIT.java |  1 +
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
index 547581c5133..5d03061f0e2 100644
--- a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
+++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
@@ -32,6 +32,7 @@ import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StringHelper;
 import org.apache.camel.vault.AwsVaultConfiguration;
 import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
 import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient;
@@ -82,6 +83,13 @@ public class SecretsManagerPropertiesFunction extends ServiceSupport implements
     private static final String CAMEL_AWS_VAULT_REGION_ENV = "CAMEL_VAULT_AWS_REGION";
     private static final String CAMEL_AWS_VAULT_USE_DEFAULT_CREDENTIALS_PROVIDER_ENV
             = "CAMEL_VAULT_AWS_USE_DEFAULT_CREDENTIALS_PROVIDER";
+
+    private static final String CAMEL_AWS_VAULT_USE_PROFILE_CREDENTIALS_PROVIDER_ENV
+            = "CAMEL_VAULT_AWS_USE_PROFILE_CREDENTIALS_PROVIDER";
+
+    private static final String CAMEL_AWS_VAULT_PROFILE_NAME_ENV
+            = "CAMEL_AWS_VAULT_PROFILE_NAME";
+
     private CamelContext camelContext;
     private SecretsManagerClient client;
 
@@ -90,6 +98,10 @@ public class SecretsManagerPropertiesFunction extends ServiceSupport implements
     private String region;
     private boolean defaultCredentialsProvider;
 
+    private boolean profleCredentialsProvider;
+
+    private String profileName;
+
     @Override
     protected void doStart() throws Exception {
         super.doStart();
@@ -99,6 +111,9 @@ public class SecretsManagerPropertiesFunction extends ServiceSupport implements
         String region = System.getenv(CAMEL_AWS_VAULT_REGION_ENV);
         boolean useDefaultCredentialsProvider
                 = Boolean.parseBoolean(System.getenv(CAMEL_AWS_VAULT_USE_DEFAULT_CREDENTIALS_PROVIDER_ENV));
+        boolean useProfileCredentialsProvider
+                = Boolean.parseBoolean(System.getenv(CAMEL_AWS_VAULT_USE_PROFILE_CREDENTIALS_PROVIDER_ENV));
+        String profileName = System.getenv(CAMEL_AWS_VAULT_PROFILE_NAME_ENV);
         if (ObjectHelper.isEmpty(accessKey) && ObjectHelper.isEmpty(secretKey) && ObjectHelper.isEmpty(region)) {
             AwsVaultConfiguration awsVaultConfiguration = getCamelContext().getVaultConfiguration().aws();
             if (ObjectHelper.isNotEmpty(awsVaultConfiguration)) {
@@ -106,6 +121,8 @@ public class SecretsManagerPropertiesFunction extends ServiceSupport implements
                 secretKey = awsVaultConfiguration.getSecretKey();
                 region = awsVaultConfiguration.getRegion();
                 useDefaultCredentialsProvider = awsVaultConfiguration.isDefaultCredentialsProvider();
+                useProfileCredentialsProvider = awsVaultConfiguration.isProfileCredentialsProvider();
+                profileName = awsVaultConfiguration.getProfileName();
             }
         }
         this.region = region;
@@ -120,6 +137,13 @@ public class SecretsManagerPropertiesFunction extends ServiceSupport implements
             SecretsManagerClientBuilder clientBuilder = SecretsManagerClient.builder();
             clientBuilder.region(Region.of(region));
             client = clientBuilder.build();
+        } else if (useProfileCredentialsProvider && ObjectHelper.isNotEmpty(profileName)) {
+            this.profleCredentialsProvider = true;
+            this.profileName = profileName;
+            SecretsManagerClientBuilder clientBuilder = SecretsManagerClient.builder();
+            clientBuilder.credentialsProvider(ProfileCredentialsProvider.create(profileName));
+            clientBuilder.region(Region.of(region));
+            client = clientBuilder.build();
         } else {
             throw new RuntimeCamelException(
                     "Using the AWS Secrets Manager Properties Function requires setting AWS credentials as application properties or environment variables");
@@ -264,9 +288,23 @@ public class SecretsManagerPropertiesFunction extends ServiceSupport implements
     }
 
     /**
-     * Whether login is using default credentials provider, or access/secret keys
+     * Whether login is using default credentials provider
      */
     public boolean isDefaultCredentialsProvider() {
         return defaultCredentialsProvider;
     }
+
+    /**
+     * Whether login is using default profile credentials provider
+     */
+    public boolean isProfleCredentialsProvider() {
+        return profleCredentialsProvider;
+    }
+
+    /**
+     * The profile name to use when using the profile credentials provider
+     */
+    public String getProfileName() {
+        return profileName;
+    }
 }
diff --git a/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java b/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java
index d404d320c97..fad6fc3f8da 100644
--- a/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java
+++ b/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java
@@ -23,6 +23,7 @@ import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
+import software.amazon.awssdk.regions.Region;
 
 import static org.junit.jupiter.api.Assertions.assertThrows;
 


[camel] 05/05: CAMEL-18625 - Provide an option to pass specific AWS SAML Profile

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

acosentino pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c89bb81df2738e32ed64add009fbb0f44608ae2f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Apr 5 16:26:28 2023 +0200

    CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../apache/camel/catalog/main/camel-main-configuration-metadata.json    | 2 ++
 .../integration/SecretsManagerNoEnvPropertiesSourceTestIT.java          | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index 70d4bde8a88..838acd24073 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -211,6 +211,8 @@
     { "name": "camel.threadpool.timeUnit", "description": "Sets the default time unit used for keep alive time", "sourceType": "org.apache.camel.main.ThreadPoolConfigurationProperties", "type": "object", "javaType": "java.util.concurrent.TimeUnit" },
     { "name": "camel.vault.aws.accessKey", "description": "The AWS access key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.defaultCredentialsProvider", "description": "Define if we want to use the AWS Default Credentials Provider or not", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.profileCredentialsProvider", "description": "Define if we want to use the AWS Profile Credentials Provider or not", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.profileName", "description": "Define the profile name to use if Profile Credentials Provider is selected", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.refreshEnabled", "description": "Whether to automatically reload Camel upon secrets being updated in AWS.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.refreshPeriod", "description": "The period (millis) between checking AWS for updated secrets.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "integer", "javaType": "long", "defaultValue": 30000 },
     { "name": "camel.vault.aws.region", "description": "The AWS region", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": "java.lang.String" },
diff --git a/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java b/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java
index fad6fc3f8da..d404d320c97 100644
--- a/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java
+++ b/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerNoEnvPropertiesSourceTestIT.java
@@ -23,7 +23,6 @@ import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
-import software.amazon.awssdk.regions.Region;
 
 import static org.junit.jupiter.api.Assertions.assertThrows;
 


[camel] 01/05: CAMEL-18625 - Provide an option to pass specific AWS SAML Profile

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

acosentino pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 12859a3ea0d067dbf5cec6763b9ca9d57edf37d3
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Apr 5 14:45:41 2023 +0200

    CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../apache/camel/vault/AwsVaultConfiguration.java  | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java b/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
index 5ad4b67752a..e686031d21a 100644
--- a/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
+++ b/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
@@ -32,6 +32,10 @@ public class AwsVaultConfiguration extends VaultConfiguration {
     @Metadata
     private boolean defaultCredentialsProvider;
     @Metadata
+    private boolean profileCredentialsProvider;
+    @Metadata
+    private String profileName;
+    @Metadata
     private boolean refreshEnabled;
     @Metadata(defaultValue = "30000")
     private long refreshPeriod = 30000;
@@ -82,6 +86,28 @@ public class AwsVaultConfiguration extends VaultConfiguration {
         this.defaultCredentialsProvider = defaultCredentialsProvider;
     }
 
+    public boolean isProfileCredentialsProvider() {
+        return profileCredentialsProvider;
+    }
+
+    /**
+     * Define if we want to use the AWS Profile Credentials Provider or not
+     */
+    public void setProfileCredentialsProvider(boolean profileCredentialsProvider) {
+        this.profileCredentialsProvider = profileCredentialsProvider;
+    }
+
+    public String getProfileName() {
+        return profileName;
+    }
+
+    /**
+     * Define the profile name to use if Profile Credentials Provider is selected
+     */
+    public void setProfileName(String profileName) {
+        this.profileName = profileName;
+    }
+
     public boolean isRefreshEnabled() {
         return refreshEnabled;
     }


[camel] 03/05: CAMEL-18625 - Provide an option to pass specific AWS SAML Profile

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

acosentino pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ed49602f9b2328822f24037ed1c60a36ec69b098
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Apr 5 14:57:46 2023 +0200

    CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../apache/camel/main/AwsVaultConfigurationConfigurer.java   | 12 ++++++++++++
 .../main/AwsVaultConfigurationPropertiesConfigurer.java      | 12 ++++++++++++
 .../META-INF/camel-main-configuration-metadata.json          |  2 ++
 core/camel-main/src/main/docs/main.adoc                      |  4 +++-
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
index e9bba9ad2dd..abf73feb90d 100644
--- a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
+++ b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
@@ -33,6 +33,10 @@ public class AwsVaultConfigurationConfigurer extends org.apache.camel.support.co
         case "GcpVaultConfiguration": target.setGcpVaultConfiguration(property(camelContext, org.apache.camel.vault.GcpVaultConfiguration.class, value)); return true;
         case "hashicorpvaultconfiguration":
         case "HashicorpVaultConfiguration": target.setHashicorpVaultConfiguration(property(camelContext, org.apache.camel.vault.HashicorpVaultConfiguration.class, value)); return true;
+        case "profilecredentialsprovider":
+        case "ProfileCredentialsProvider": target.setProfileCredentialsProvider(property(camelContext, boolean.class, value)); return true;
+        case "profilename":
+        case "ProfileName": target.setProfileName(property(camelContext, java.lang.String.class, value)); return true;
         case "refreshenabled":
         case "RefreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true;
         case "refreshperiod":
@@ -62,6 +66,10 @@ public class AwsVaultConfigurationConfigurer extends org.apache.camel.support.co
         case "GcpVaultConfiguration": return org.apache.camel.vault.GcpVaultConfiguration.class;
         case "hashicorpvaultconfiguration":
         case "HashicorpVaultConfiguration": return org.apache.camel.vault.HashicorpVaultConfiguration.class;
+        case "profilecredentialsprovider":
+        case "ProfileCredentialsProvider": return boolean.class;
+        case "profilename":
+        case "ProfileName": return java.lang.String.class;
         case "refreshenabled":
         case "RefreshEnabled": return boolean.class;
         case "refreshperiod":
@@ -92,6 +100,10 @@ public class AwsVaultConfigurationConfigurer extends org.apache.camel.support.co
         case "GcpVaultConfiguration": return target.getGcpVaultConfiguration();
         case "hashicorpvaultconfiguration":
         case "HashicorpVaultConfiguration": return target.getHashicorpVaultConfiguration();
+        case "profilecredentialsprovider":
+        case "ProfileCredentialsProvider": return target.isProfileCredentialsProvider();
+        case "profilename":
+        case "ProfileName": return target.getProfileName();
         case "refreshenabled":
         case "RefreshEnabled": return target.isRefreshEnabled();
         case "refreshperiod":
diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
index 614950cfbe2..e928064bb7e 100644
--- a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
+++ b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
@@ -33,6 +33,10 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel.
         case "GcpVaultConfiguration": target.setGcpVaultConfiguration(property(camelContext, org.apache.camel.vault.GcpVaultConfiguration.class, value)); return true;
         case "hashicorpvaultconfiguration":
         case "HashicorpVaultConfiguration": target.setHashicorpVaultConfiguration(property(camelContext, org.apache.camel.vault.HashicorpVaultConfiguration.class, value)); return true;
+        case "profilecredentialsprovider":
+        case "ProfileCredentialsProvider": target.setProfileCredentialsProvider(property(camelContext, boolean.class, value)); return true;
+        case "profilename":
+        case "ProfileName": target.setProfileName(property(camelContext, java.lang.String.class, value)); return true;
         case "refreshenabled":
         case "RefreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true;
         case "refreshperiod":
@@ -62,6 +66,10 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel.
         case "GcpVaultConfiguration": return org.apache.camel.vault.GcpVaultConfiguration.class;
         case "hashicorpvaultconfiguration":
         case "HashicorpVaultConfiguration": return org.apache.camel.vault.HashicorpVaultConfiguration.class;
+        case "profilecredentialsprovider":
+        case "ProfileCredentialsProvider": return boolean.class;
+        case "profilename":
+        case "ProfileName": return java.lang.String.class;
         case "refreshenabled":
         case "RefreshEnabled": return boolean.class;
         case "refreshperiod":
@@ -92,6 +100,10 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel.
         case "GcpVaultConfiguration": return target.getGcpVaultConfiguration();
         case "hashicorpvaultconfiguration":
         case "HashicorpVaultConfiguration": return target.getHashicorpVaultConfiguration();
+        case "profilecredentialsprovider":
+        case "ProfileCredentialsProvider": return target.isProfileCredentialsProvider();
+        case "profilename":
+        case "ProfileName": return target.getProfileName();
         case "refreshenabled":
         case "RefreshEnabled": return target.isRefreshEnabled();
         case "refreshperiod":
diff --git a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 70d4bde8a88..838acd24073 100644
--- a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -211,6 +211,8 @@
     { "name": "camel.threadpool.timeUnit", "description": "Sets the default time unit used for keep alive time", "sourceType": "org.apache.camel.main.ThreadPoolConfigurationProperties", "type": "object", "javaType": "java.util.concurrent.TimeUnit" },
     { "name": "camel.vault.aws.accessKey", "description": "The AWS access key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.defaultCredentialsProvider", "description": "Define if we want to use the AWS Default Credentials Provider or not", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.profileCredentialsProvider", "description": "Define if we want to use the AWS Profile Credentials Provider or not", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.profileName", "description": "Define the profile name to use if Profile Credentials Provider is selected", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.refreshEnabled", "description": "Whether to automatically reload Camel upon secrets being updated in AWS.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.refreshPeriod", "description": "The period (millis) between checking AWS for updated secrets.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "integer", "javaType": "long", "defaultValue": 30000 },
     { "name": "camel.vault.aws.region", "description": "The AWS region", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": "java.lang.String" },
diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc
index c364c25c624..866f53f85c7 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -210,13 +210,15 @@ The camel.rest supports 27 options, which are listed below.
 |===
 
 === Camel AWS Vault configurations
-The camel.vault.aws supports 7 options, which are listed below.
+The camel.vault.aws supports 9 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *camel.vault.aws.accessKey* | The AWS access key |  | String
 | *camel.vault.aws.default{zwsp}CredentialsProvider* | Define if we want to use the AWS Default Credentials Provider or not | false | boolean
+| *camel.vault.aws.profile{zwsp}CredentialsProvider* | Define if we want to use the AWS Profile Credentials Provider or not | false | boolean
+| *camel.vault.aws.profileName* | Define the profile name to use if Profile Credentials Provider is selected |  | String
 | *camel.vault.aws.refreshEnabled* | Whether to automatically reload Camel upon secrets being updated in AWS. | false | boolean
 | *camel.vault.aws.refreshPeriod* | The period (millis) between checking AWS for updated secrets. | 30000 | long
 | *camel.vault.aws.region* | The AWS region |  | String


[camel] 02/05: CAMEL-18625 - Provide an option to pass specific AWS SAML Profile

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

acosentino pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 61ed938fdb7bd4167ee20233fba356965623e954
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Apr 5 14:51:11 2023 +0200

    CAMEL-18625 - Provide an option to pass specific AWS SAML Profile
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../main/AwsVaultConfigurationProperties.java      | 16 ++++++
 .../java/org/apache/camel/main/MainVaultTest.java  | 59 ++++++++++++++++++++++
 2 files changed, 75 insertions(+)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
index ce7b852e001..9dc9e3d3a7e 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
@@ -81,6 +81,22 @@ public class AwsVaultConfigurationProperties extends AwsVaultConfiguration imple
         return this;
     }
 
+    /**
+     * Define if we want to use the AWS Profile Credentials Provider or not
+     */
+    public AwsVaultConfigurationProperties withProfileCredentialsProvider(boolean profileCredentialsProvider) {
+        setProfileCredentialsProvider(profileCredentialsProvider);
+        return this;
+    }
+
+    /**
+     * Define the profile name if we are using the Profile Credentials Provider
+     */
+    public AwsVaultConfigurationProperties withProfileName(String profileName) {
+        setProfileName(profileName);
+        return this;
+    }
+
     /**
      * Whether to automatically reload Camel upon secrets being updated in AWS.
      */
diff --git a/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java b/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
index 2fa3b20d2e3..acb016a0e7a 100644
--- a/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
+++ b/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
@@ -53,6 +53,35 @@ public class MainVaultTest {
         main.stop();
     }
 
+    @Test
+    public void testMainProfileAws() throws Exception {
+        Main main = new Main();
+
+        main.addInitialProperty("camel.vault.aws.accessKey", "myKey");
+        main.addInitialProperty("camel.vault.aws.secretKey", "mySecret");
+        main.addInitialProperty("camel.vault.aws.region", "myRegion");
+        main.addInitialProperty("camel.vault.aws.defaultCredentialsProvider", "false");
+        main.addInitialProperty("camel.vault.aws.profileCredentialsProvider", "true");
+        main.addInitialProperty("camel.vault.aws.profileName", "jack");
+
+        main.start();
+
+        CamelContext context = main.getCamelContext();
+        assertNotNull(context);
+
+        AwsVaultConfiguration cfg = context.getVaultConfiguration().aws();
+        assertNotNull(cfg);
+
+        Assertions.assertEquals("myKey", cfg.getAccessKey());
+        Assertions.assertEquals("mySecret", cfg.getSecretKey());
+        Assertions.assertEquals("myRegion", cfg.getRegion());
+        Assertions.assertEquals(false, cfg.isDefaultCredentialsProvider());
+        Assertions.assertEquals(true, cfg.isProfileCredentialsProvider());
+        Assertions.assertEquals("jack", cfg.getProfileName());
+
+        main.stop();
+    }
+
     @Test
     public void testMainAwsFluent() throws Exception {
         Main main = new Main();
@@ -79,6 +108,36 @@ public class MainVaultTest {
         main.stop();
     }
 
+    @Test
+    public void testMainAwsProfileFluent() throws Exception {
+        Main main = new Main();
+        main.configure().vault().aws()
+                .withAccessKey("myKey")
+                .withSecretKey("mySecret")
+                .withRegion("myRegion")
+                .withDefaultCredentialsProvider(false)
+                .withProfileCredentialsProvider(true)
+                .withProfileName("jack")
+                .end();
+
+        main.start();
+
+        CamelContext context = main.getCamelContext();
+        assertNotNull(context);
+
+        AwsVaultConfiguration cfg = context.getVaultConfiguration().aws();
+        assertNotNull(cfg);
+
+        Assertions.assertEquals("myKey", cfg.getAccessKey());
+        Assertions.assertEquals("mySecret", cfg.getSecretKey());
+        Assertions.assertEquals("myRegion", cfg.getRegion());
+        Assertions.assertEquals(false, cfg.isDefaultCredentialsProvider());
+        Assertions.assertEquals(true, cfg.isProfileCredentialsProvider());
+        Assertions.assertEquals("jack", cfg.getProfileName());
+
+        main.stop();
+    }
+
     @Test
     public void testMainGcp() throws Exception {
         Main main = new Main();