diff --git a/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java b/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java index 891f374a66..5ddb3c1c0c 100644 --- a/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java +++ b/connector-runtime/spring-boot-starter-camunda-connectors/src/main/java/io/camunda/connector/runtime/OutboundConnectorsAutoConfiguration.java @@ -61,13 +61,17 @@ public class OutboundConnectorsAutoConfiguration { private static final Logger LOG = LoggerFactory.getLogger(OutboundConnectorsAutoConfiguration.class); + @Value("${camunda.connector.secretprovider.discovery.enabled:true}") Boolean secretProviderLookupEnabled; + @Value("${camunda.connector.secretprovider.environment.prefix:}") String environmentSecretProviderPrefix; + @Value( "${camunda.connector.secretprovider.console.endpoint:https://cluster-api.cloud.camunda.io/secrets}") String consoleSecretsApiEndpoint; + @Value("${camunda.connector.secretprovider.console.audience:secrets.camunda.io}") String consoleSecretsApiAudience; @@ -159,8 +163,7 @@ public ConsoleSecretApiClient consoleSecretApiClient(CamundaClientProperties cli @Bean @ConditionalOnMissingBean public ObjectMapper objectMapper(DocumentFactory documentFactory) { - ConnectorsObjectMapperSupplier.getCopy( - documentFactory, DocumentModuleSettings.create()); + ConnectorsObjectMapperSupplier.getCopy(documentFactory, DocumentModuleSettings.create()); return ConnectorsObjectMapperSupplier.getCopy(); } } diff --git a/connector-sdk/core/src/main/java/io/camunda/connector/api/json/ConnectorsObjectMapperSupplier.java b/connector-sdk/core/src/main/java/io/camunda/connector/api/json/ConnectorsObjectMapperSupplier.java index 390d8d8a85..21e0d05025 100644 --- a/connector-sdk/core/src/main/java/io/camunda/connector/api/json/ConnectorsObjectMapperSupplier.java +++ b/connector-sdk/core/src/main/java/io/camunda/connector/api/json/ConnectorsObjectMapperSupplier.java @@ -27,8 +27,6 @@ import io.camunda.connector.document.annotation.jackson.JacksonModuleDocument.DocumentModuleSettings; import io.camunda.connector.feel.jackson.JacksonModuleFeelFunction; import io.camunda.document.factory.DocumentFactory; -import io.camunda.document.factory.DocumentFactoryImpl; -import io.camunda.document.store.InMemoryDocumentStore; /** Default ObjectMapper supplier to be used by the connector runtime. */ public class ConnectorsObjectMapperSupplier { @@ -46,8 +44,7 @@ public class ConnectorsObjectMapperSupplier { private ConnectorsObjectMapperSupplier() {} public static ObjectMapper getCopy() { - return DEFAULT_MAPPER - .copy(); + return DEFAULT_MAPPER.copy(); } public static ObjectMapper getCopy(DocumentFactory factory, DocumentModuleSettings settings) { diff --git a/connectors-e2e-test/connectors-e2e-test-rabbitmq/src/test/java/io/camunda/connector/e2e/RabbitMqInboundStartEventTests.java b/connectors-e2e-test/connectors-e2e-test-rabbitmq/src/test/java/io/camunda/connector/e2e/RabbitMqInboundStartEventTests.java index 6dc1778e2b..00cbaf2d38 100644 --- a/connectors-e2e-test/connectors-e2e-test-rabbitmq/src/test/java/io/camunda/connector/e2e/RabbitMqInboundStartEventTests.java +++ b/connectors-e2e-test/connectors-e2e-test-rabbitmq/src/test/java/io/camunda/connector/e2e/RabbitMqInboundStartEventTests.java @@ -131,9 +131,10 @@ public void uriAuthenticationReceiveMessageTest() throws Exception { private void assertIntermediateCatchEventUsingModel(BpmnModelInstance model) throws Exception { Object expectedJsonResponse = - ConnectorsObjectMapperSupplier.getCopy().readValue( - "{\"message\":{\"consumerTag\":\"myConsumerTag\",\"body\":{\"foo\": {\"bar\": \"barValue\"}},\"properties\":{}}}", - Object.class); + ConnectorsObjectMapperSupplier.getCopy() + .readValue( + "{\"message\":{\"consumerTag\":\"myConsumerTag\",\"body\":{\"foo\": {\"bar\": \"barValue\"}},\"properties\":{}}}", + Object.class); processStateStore.update(mockProcessDefinition(model)); diff --git a/connectors/http/graphql/src/test/java/io/camunda/connector/http/graphql/GraphQLFunctionTest.java b/connectors/http/graphql/src/test/java/io/camunda/connector/http/graphql/GraphQLFunctionTest.java index 7141551065..17c351700b 100644 --- a/connectors/http/graphql/src/test/java/io/camunda/connector/http/graphql/GraphQLFunctionTest.java +++ b/connectors/http/graphql/src/test/java/io/camunda/connector/http/graphql/GraphQLFunctionTest.java @@ -100,8 +100,7 @@ void execute_shouldSetConnectTime(final String input) throws Exception { objectMapper.readValue(input, ObjectNode.class).get("graphql").toString(), GraphQLRequest.GraphQL.class) .connectionTimeoutInSeconds(); - var graphQLRequestMapper = - new GraphQLRequestMapper(ConnectorsObjectMapperSupplier.getCopy()); + var graphQLRequestMapper = new GraphQLRequestMapper(ConnectorsObjectMapperSupplier.getCopy()); // when var request = diff --git a/connectors/http/http-base/src/main/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionService.java b/connectors/http/http-base/src/main/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionService.java index 8f5dae48d3..b7056e43f6 100644 --- a/connectors/http/http-base/src/main/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionService.java +++ b/connectors/http/http-base/src/main/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionService.java @@ -57,8 +57,7 @@ public HttpCommonRequest toCloudFunctionRequest(final HttpCommonRequest request) try { // Using the JsonHttpContent cannot work with an element on the root content, // hence write it ourselves: - String contentAsJson = - ConnectorsObjectMapperSupplier.getCopy().writeValueAsString(request); + String contentAsJson = ConnectorsObjectMapperSupplier.getCopy().writeValueAsString(request); String token = credentials.getOAuthToken(getProxyFunctionUrl()); return createCloudFunctionRequest(contentAsJson, token); } catch (IOException e) { diff --git a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/ApacheRequestFactoryTest.java b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/ApacheRequestFactoryTest.java index c830efb23d..444fdc53dc 100644 --- a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/ApacheRequestFactoryTest.java +++ b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/ApacheRequestFactoryTest.java @@ -348,8 +348,7 @@ public void shouldSetJsonBody_whenBodySupportedAndContentTypeNotProvided() throw assertThat(httpRequest.getEntity().getContentType()) .isEqualTo(ContentType.APPLICATION_JSON.withCharset(StandardCharsets.UTF_8).toString()); var jsonNode = - ConnectorsObjectMapperSupplier.getCopy().readTree( - httpRequest.getEntity().getContent()); + ConnectorsObjectMapperSupplier.getCopy().readTree(httpRequest.getEntity().getContent()); assertThat(jsonNode.get("key").asText()).isEqualTo("value"); } @@ -374,8 +373,7 @@ public void shouldNotSetJsonBody_whenBodySupportedAndContentTypeProvided() throw assertThat(httpRequest.getEntity().getContentType()) .isEqualTo(ContentType.TEXT_PLAIN.withCharset(StandardCharsets.UTF_8).toString()); var jsonNode = - ConnectorsObjectMapperSupplier.getCopy().readTree( - httpRequest.getEntity().getContent()); + ConnectorsObjectMapperSupplier.getCopy().readTree(httpRequest.getEntity().getContent()); assertThat(jsonNode.get("key").asText()).isEqualTo("value"); } @@ -400,8 +398,7 @@ public void shouldSetJsonBody_whenBodySupportedAndContentTypeProvided() throws E assertThat(httpRequest.getEntity().getContentType()) .isEqualTo(ContentType.APPLICATION_JSON.withCharset(StandardCharsets.UTF_8).toString()); var jsonNode = - ConnectorsObjectMapperSupplier.getCopy().readTree( - httpRequest.getEntity().getContent()); + ConnectorsObjectMapperSupplier.getCopy().readTree(httpRequest.getEntity().getContent()); assertThat(jsonNode.get("key").asText()).isEqualTo("value"); } @@ -427,8 +424,7 @@ public void shouldSetJsonBody_whenBodySupportedAndContentTypeProvidedAndBodyIsMa assertThat(httpRequest.getEntity().getContentType()) .isEqualTo(ContentType.APPLICATION_JSON.withCharset(StandardCharsets.UTF_8).toString()); var jsonNode = - ConnectorsObjectMapperSupplier.getCopy().readTree( - httpRequest.getEntity().getContent()); + ConnectorsObjectMapperSupplier.getCopy().readTree(httpRequest.getEntity().getContent()); assertThat(jsonNode.get("key").asText()).isEqualTo("value"); } diff --git a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/HttpCommonResultResponseHandlerTest.java b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/HttpCommonResultResponseHandlerTest.java index 7af47eecf9..eae4dd0c3f 100644 --- a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/HttpCommonResultResponseHandlerTest.java +++ b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/client/apache/HttpCommonResultResponseHandlerTest.java @@ -107,8 +107,8 @@ public void shouldHandleError_whenCloudFunctionEnabled() throws Exception { response.setHeaders(headers); response.setEntity( new StringEntity( - ConnectorsObjectMapperSupplier.getCopy().writeValueAsString( - new ErrorResponse("500", "Custom message", null)))); + ConnectorsObjectMapperSupplier.getCopy() + .writeValueAsString(new ErrorResponse("500", "Custom message", null)))); // when HttpCommonResult result = handler.handleResponse(response); diff --git a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionResponseTransformer.java b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionResponseTransformer.java index dc72c4e6ae..f6961cda9e 100644 --- a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionResponseTransformer.java +++ b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionResponseTransformer.java @@ -45,8 +45,8 @@ public Response transform(Response response, ServeEvent serveEvent) { .but() .status(200) .body( - ConnectorsObjectMapperSupplier.getCopy().writeValueAsString( - httpService.executeConnectorRequest(request))) + ConnectorsObjectMapperSupplier.getCopy() + .writeValueAsString(httpService.executeConnectorRequest(request))) .build(); } catch (ConnectorException e) { try { @@ -54,8 +54,9 @@ public Response transform(Response response, ServeEvent serveEvent) { .status(500) .headers(new HttpHeaders(new HttpHeader("Content-Type", "application/json"))) .body( - ConnectorsObjectMapperSupplier.getCopy().writeValueAsString( - new ErrorResponse(e.getErrorCode(), e.getMessage(), e.getErrorVariables()))) + ConnectorsObjectMapperSupplier.getCopy() + .writeValueAsString( + new ErrorResponse(e.getErrorCode(), e.getMessage(), e.getErrorVariables()))) .build(); } catch (JsonProcessingException ex) { throw new RuntimeException(ex); diff --git a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionServiceTest.java b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionServiceTest.java index f29eedec94..bed8a109f9 100644 --- a/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionServiceTest.java +++ b/connectors/http/http-base/src/test/java/io/camunda/connector/http/base/cloudfunction/CloudFunctionServiceTest.java @@ -75,8 +75,8 @@ public void shouldConvertToCloudFunctionRequest() throws IOException { assertThat(cloudFunctionRequest.getHeaders().orElse(Map.of())) .containsEntry("Content-Type", "application/json"); Map body = - ConnectorsObjectMapperSupplier.getCopy().readValue( - (String) cloudFunctionRequest.getBody(), Map.class); + ConnectorsObjectMapperSupplier.getCopy() + .readValue((String) cloudFunctionRequest.getBody(), Map.class); assertThat(body).containsEntry("url", "theUrl"); assertThat(body).containsEntry("method", "POST"); assertThat(body) diff --git a/secret-providers/gcp-secret-provider/src/main/java/io/camunda/connector/runtime/cloud/GcpSecretManagerSecretProvider.java b/secret-providers/gcp-secret-provider/src/main/java/io/camunda/connector/runtime/cloud/GcpSecretManagerSecretProvider.java index 95a3129d39..36dd314b13 100644 --- a/secret-providers/gcp-secret-provider/src/main/java/io/camunda/connector/runtime/cloud/GcpSecretManagerSecretProvider.java +++ b/secret-providers/gcp-secret-provider/src/main/java/io/camunda/connector/runtime/cloud/GcpSecretManagerSecretProvider.java @@ -42,6 +42,7 @@ public class GcpSecretManagerSecretProvider implements SecretProvider { /** Secrets used as fallback if SecretProvider is loaded via SPI */ public static final String SECRETS_PROJECT_ENV_NAME = "SECRETS_PROJECT_ID"; + public static final String SECRETS_PREFIX_ENV_NAME = "SECRETS_PREFIX"; public static final String CLUSTER_ID_ENV_NAME = "CAMUNDA_CLUSTER_ID"; public static final String SECRETS_CACHE_MILLIS_ENV_NAME =