This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit c7018a2f19126cbdb4a0acd175132228b86ca61f Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon Jun 19 14:29:26 2023 +0200 CAMEL-19159 - Camel-AWS: Support Profile Credential provider as configuration - AWS STS Signed-off-by: Andrea Cosentino <anco...@gmail.com> --- .../camel/component/aws2/sts/STS2Component.java | 4 ++-- .../component/aws2/sts/STS2Configuration.java | 26 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java b/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java index 1bd98055a7f..59c9293c815 100644 --- a/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java +++ b/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java @@ -47,11 +47,11 @@ public class STS2Component extends DefaultComponent { STS2Configuration configurationClone = this.configuration != null ? this.configuration.copy() : new STS2Configuration(); STS2Endpoint endpoint = new STS2Endpoint(uri, this, configurationClone); setProperties(endpoint, parameters); - if (Boolean.FALSE.equals(configurationClone.isUseDefaultCredentialsProvider()) + if (Boolean.FALSE.equals(configurationClone.isUseDefaultCredentialsProvider()) && Boolean.FALSE.equals(configurationClone.isUseProfileCredentialsProvider()) && configurationClone.getStsClient() == null && (configurationClone.getAccessKey() == null || configurationClone.getSecretKey() == null)) { throw new IllegalArgumentException( - "useDefaultCredentialsProvider is set to false, Amazon STS client or accessKey and secretKey must be specified"); + "useDefaultCredentialsProvider is set to false, useProfileCredentialsProvider is set to false, Amazon STS client or accessKey and secretKey must be specified"); } return endpoint; diff --git a/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java b/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java index a200abcde90..a2b13beb4b2 100644 --- a/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java +++ b/components/camel-aws/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java @@ -59,6 +59,10 @@ public class STS2Configuration implements Cloneable { private String uriEndpointOverride; @UriParam(defaultValue = "false") private boolean useDefaultCredentialsProvider; + @UriParam(defaultValue = "false") + private boolean useProfileCredentialsProvider; + @UriParam + private String profileCredentialsName; public StsClient getStsClient() { return stsClient; @@ -205,6 +209,28 @@ public class STS2Configuration implements Cloneable { public Boolean isUseDefaultCredentialsProvider() { return useDefaultCredentialsProvider; } + + public boolean isUseProfileCredentialsProvider() { + return useProfileCredentialsProvider; + } + + /** + * Set whether the STS client should expect to load credentials through a profile credentials provider. + */ + public void setUseProfileCredentialsProvider(boolean useProfileCredentialsProvider) { + this.useProfileCredentialsProvider = useProfileCredentialsProvider; + } + + public String getProfileCredentialsName() { + return profileCredentialsName; + } + + /** + * If using a profile credentials provider this parameter will set the profile name + */ + public void setProfileCredentialsName(String profileCredentialsName) { + this.profileCredentialsName = profileCredentialsName; + } // ************************************************* // // *************************************************