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 2020/11/18 10:53:48 UTC
[camel] 01/06: CAMEL-15836 - Camel-AWS2-STS: enable autowire on the
STS Client
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2fed7cb7d6fd853c436f0f8b7abe67dd0631c9c7
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 18 10:44:58 2020 +0100
CAMEL-15836 - Camel-AWS2-STS: enable autowire on the STS Client
---
.../apache/camel/component/aws2/sts/STS2Component.java | 18 ------------------
.../camel/component/aws2/sts/STS2Configuration.java | 15 +--------------
2 files changed, 1 insertion(+), 32 deletions(-)
diff --git a/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java b/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java
index 4519526..1078058 100644
--- a/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java
+++ b/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Component.java
@@ -55,9 +55,6 @@ public class STS2Component extends DefaultComponent {
STS2Configuration configuration = this.configuration != null ? this.configuration.copy() : new STS2Configuration();
STS2Endpoint endpoint = new STS2Endpoint(uri, this, configuration);
setProperties(endpoint, parameters);
- if (endpoint.getConfiguration().isAutoDiscoverClient()) {
- checkAndSetRegistryClient(configuration, endpoint);
- }
if (configuration.getStsClient() == null
&& (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
throw new IllegalArgumentException("Amazon STS client or accessKey and secretKey must be specified");
@@ -76,19 +73,4 @@ public class STS2Component extends DefaultComponent {
public void setConfiguration(STS2Configuration configuration) {
this.configuration = configuration;
}
-
- private void checkAndSetRegistryClient(STS2Configuration configuration, STS2Endpoint endpoint) {
- if (ObjectHelper.isEmpty(endpoint.getConfiguration().getStsClient())) {
- LOG.debug("Looking for an StsClient instance in the registry");
- Set<StsClient> clients = getCamelContext().getRegistry().findByType(StsClient.class);
- if (clients.size() == 1) {
- LOG.debug("Found exactly one StsClient instance in the registry");
- configuration.setStsClient(clients.stream().findFirst().get());
- } else {
- LOG.debug("No StsClient instance in the registry");
- }
- } else {
- LOG.debug("StsClient instance is already set at endpoint level: skipping the check in the registry");
- }
- }
}
diff --git a/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java b/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java
index 2cc043d..ecf0679 100644
--- a/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java
+++ b/components/camel-aws2-sts/src/main/java/org/apache/camel/component/aws2/sts/STS2Configuration.java
@@ -32,6 +32,7 @@ public class STS2Configuration implements Cloneable {
@Metadata(required = true)
private String label;
@UriParam
+ @Metadata(autowired = true)
private StsClient stsClient;
@UriParam(label = "security", secret = true)
private String accessKey;
@@ -52,8 +53,6 @@ public class STS2Configuration implements Cloneable {
private boolean pojoRequest;
@UriParam(defaultValue = "false")
private boolean trustAllCertificates;
- @UriParam(label = "common", defaultValue = "true")
- private boolean autoDiscoverClient = true;
public StsClient getStsClient() {
return stsClient;
@@ -166,18 +165,6 @@ public class STS2Configuration implements Cloneable {
this.trustAllCertificates = trustAllCertificates;
}
- public boolean isAutoDiscoverClient() {
- return autoDiscoverClient;
- }
-
- /**
- * Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry
- * automatically otherwise it will skip that checking.
- */
- public void setAutoDiscoverClient(boolean autoDiscoverClient) {
- this.autoDiscoverClient = autoDiscoverClient;
- }
-
// *************************************************
//
// *************************************************