diff --git a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/AbstractMqtt5EndpointIntegrationTest.java b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/AbstractMqtt5EndpointIntegrationTest.java index f70c6f53133..bf61b48989d 100644 --- a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/AbstractMqtt5EndpointIntegrationTest.java +++ b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/AbstractMqtt5EndpointIntegrationTest.java @@ -149,7 +149,12 @@ public void configureApi(ReactableApi api, Class definitionClass) { .flatMap(eg -> eg.getEndpoints().stream()) .filter(endpoint -> endpoint.getType().equals("mqtt5")) .forEach(endpoint -> - endpoint.setConfiguration(endpoint.getConfiguration().replace("mqtt5-port", Integer.toString(mqtt5.getMqttPort()))) + endpoint.setConfiguration( + endpoint + .getConfiguration() + .replace("mqtt5-host", mqtt5.getHost()) + .replace("mqtt5-port", Integer.toString(mqtt5.getMqttPort())) + ) ); } } diff --git a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointMqtt5EndpointIntegrationTest.java b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointMqtt5EndpointIntegrationTest.java index 664cf1c0813..ec12fcd9243 100644 --- a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointMqtt5EndpointIntegrationTest.java +++ b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointMqtt5EndpointIntegrationTest.java @@ -18,17 +18,27 @@ import static org.assertj.core.api.Assertions.assertThat; import com.graviteesource.entrypoint.http.get.HttpGetEntrypointConnectorFactory; +import com.graviteesource.secretprovider.hcvault.HCVaultSecretProvider; +import com.graviteesource.secretprovider.hcvault.HCVaultSecretProviderFactory; +import com.graviteesource.secretprovider.hcvault.config.manager.VaultConfig; +import com.graviteesource.service.secrets.SecretsService; import com.hivemq.client.mqtt.datatypes.MqttQos; import io.gravitee.apim.gateway.tests.sdk.annotations.DeployApi; import io.gravitee.apim.gateway.tests.sdk.annotations.GatewayTest; +import io.gravitee.apim.gateway.tests.sdk.configuration.GatewayConfigurationBuilder; import io.gravitee.apim.gateway.tests.sdk.connector.EntrypointBuilder; +import io.gravitee.apim.gateway.tests.sdk.secrets.SecretProviderBuilder; import io.gravitee.apim.integration.tests.fake.MessageFlowReadyPolicy; import io.gravitee.apim.integration.tests.messages.AbstractMqtt5EndpointIntegrationTest; import io.gravitee.common.http.MediaType; +import io.gravitee.common.service.AbstractService; import io.gravitee.common.utils.UUID; import io.gravitee.gateway.api.http.HttpHeaderNames; import io.gravitee.gateway.reactive.api.qos.Qos; +import io.gravitee.node.secrets.plugins.SecretProviderPlugin; import io.gravitee.plugin.entrypoint.EntrypointConnectorPlugin; +import io.gravitee.secrets.api.plugin.SecretManagerConfiguration; +import io.gravitee.secrets.api.plugin.SecretProviderFactory; import io.reactivex.rxjava3.annotations.NonNull; import io.reactivex.rxjava3.core.Completable; import io.reactivex.rxjava3.core.Flowable; @@ -41,19 +51,24 @@ import io.vertx.rxjava3.core.buffer.Buffer; import io.vertx.rxjava3.core.http.HttpClient; import io.vertx.rxjava3.core.http.HttpClientResponse; +import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; +import org.testcontainers.containers.Container; +import org.testcontainers.vault.VaultContainer; /** * @author Yann TAVERNIER (yann.tavernier at graviteesource.com) @@ -63,11 +78,63 @@ @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) class HttpGetEntrypointMqtt5EndpointIntegrationTest extends AbstractMqtt5EndpointIntegrationTest { + private static final String VAULT_TOKEN = java.util.UUID.randomUUID().toString(); + + @org.testcontainers.junit.jupiter.Container + protected static final VaultContainer vaultContainer = new VaultContainer<>("hashicorp/vault:1.13.3") + .withVaultToken(VAULT_TOKEN) + .dependsOn(mqtt5); + + @AfterAll + static void cleanup() { + vaultContainer.close(); + } + @Override public void configureEntrypoints(Map> entrypoints) { entrypoints.putIfAbsent("http-get", EntrypointBuilder.build("http-get", HttpGetEntrypointConnectorFactory.class)); } + @Override + public void configureGateway(GatewayConfigurationBuilder configurationBuilder) { + super.configureGateway(configurationBuilder); + // create a renewable token so the plugin does not start panicking + Container.ExecResult execResult; + try { + execResult = vaultContainer.execInContainer("vault", "token", "create", "-period=10m", "-field", "token"); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + String token = execResult.getStdout(); + configurationBuilder.setYamlProperty("api.secrets.providers[0].plugin", "vault"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.enabled", true); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.host", vaultContainer.getHost()); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.port", vaultContainer.getMappedPort(8200)); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.ssl.enabled", "false"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.auth.method", "token"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.auth.config.token", token); + try { + vaultContainer.execInContainer("vault", "kv", "put", "secret/mqtt5", "host=" + mqtt5.getHost()); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + } + + @Override + public void configureSecretProviders( + Set, ? extends SecretManagerConfiguration>> secretProviderPlugins + ) { + secretProviderPlugins.add( + SecretProviderBuilder.build(HCVaultSecretProvider.PLUGIN_ID, HCVaultSecretProviderFactory.class, VaultConfig.class) + ); + } + + @Override + public void configureServices(Set>> services) { + super.configureServices(services); + services.add(SecretsService.class); + } + @ParameterizedTest @MethodSource("qosParameters") @DeployApi({ "/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-auto.json", "/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-none.json" }) @@ -216,6 +283,28 @@ void should_receive_error_messages_when_error_occurred(HttpClient httpClient) { }); } + @Test + @DeployApi({ "/apis/v4/messages/mqtt5/mqtt5-endpoint-secret.json" }) + void should_receive_messages_with_secret(HttpClient httpClient) { + final int messageCount = 10; + final List readyObs = new ArrayList<>(); + + final Single get = createGetRequest("/test-secret", UUID.random().toString(), httpClient, readyObs); + + final TestSubscriber obs = Flowable + .fromSingle(get.doOnSuccess(response -> assertThat(response.statusCode()).isEqualTo(200))) + .concatWith(publishMessagesWhenReady(readyObs, TEST_TOPIC + "-secret", MqttQos.AT_LEAST_ONCE)) + .flatMap(response -> response.rxBody().flatMapPublisher(buffer -> extractMessages(buffer, extractTransactionId(response)))) + .take(messageCount) + .test() + .awaitDone(30, TimeUnit.SECONDS) + .assertValueCount(messageCount); + + verifyMessagesAreOrdered(messageCount, obs); + verifyMessagesAreUniques(messageCount, obs); + verifyMessagesAreBetweenRange(0, messageCount, obs); + } + @NonNull private Flowable extractMessages(Buffer body, String transactionId) { final JsonObject jsonResponse = new JsonObject(body.toString()); diff --git a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointRabbitMQEndpointIntegrationTest.java b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointRabbitMQEndpointIntegrationTest.java index c931871ffaa..34352a06994 100644 --- a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointRabbitMQEndpointIntegrationTest.java +++ b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointRabbitMQEndpointIntegrationTest.java @@ -18,34 +18,101 @@ import static org.assertj.core.api.Assertions.assertThat; import com.graviteesource.entrypoint.http.get.HttpGetEntrypointConnectorFactory; +import com.graviteesource.secretprovider.hcvault.HCVaultSecretProvider; +import com.graviteesource.secretprovider.hcvault.HCVaultSecretProviderFactory; +import com.graviteesource.secretprovider.hcvault.config.manager.VaultConfig; +import com.graviteesource.service.secrets.SecretsService; import io.gravitee.apim.gateway.tests.sdk.annotations.DeployApi; import io.gravitee.apim.gateway.tests.sdk.annotations.GatewayTest; +import io.gravitee.apim.gateway.tests.sdk.configuration.GatewayConfigurationBuilder; import io.gravitee.apim.gateway.tests.sdk.connector.EntrypointBuilder; +import io.gravitee.apim.gateway.tests.sdk.secrets.SecretProviderBuilder; import io.gravitee.apim.integration.tests.messages.AbstractRabbitMQEndpointIntegrationTest; import io.gravitee.common.http.MediaType; +import io.gravitee.common.service.AbstractService; import io.gravitee.gateway.api.http.HttpHeaderNames; import io.gravitee.gateway.reactive.api.qos.Qos; +import io.gravitee.node.secrets.plugins.SecretProviderPlugin; import io.gravitee.plugin.entrypoint.EntrypointConnectorPlugin; +import io.gravitee.secrets.api.plugin.SecretManagerConfiguration; +import io.gravitee.secrets.api.plugin.SecretProviderFactory; import io.vertx.core.http.HttpMethod; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.rxjava3.core.http.HttpClient; import io.vertx.rxjava3.core.http.HttpClientResponse; +import java.io.IOException; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.TimeUnit; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; +import org.testcontainers.containers.Container; +import org.testcontainers.vault.VaultContainer; @GatewayTest class HttpGetEntrypointRabbitMQEndpointIntegrationTest extends AbstractRabbitMQEndpointIntegrationTest { + private static final String VAULT_TOKEN = java.util.UUID.randomUUID().toString(); + + @org.testcontainers.junit.jupiter.Container + protected static final VaultContainer vaultContainer = new VaultContainer<>("hashicorp/vault:1.13.3") + .withVaultToken(VAULT_TOKEN) + .dependsOn(rabbitmqContainer); + + @AfterAll + static void cleanup() { + vaultContainer.close(); + } + @Override public void configureEntrypoints(Map> entrypoints) { entrypoints.putIfAbsent("http-get", EntrypointBuilder.build("http-get", HttpGetEntrypointConnectorFactory.class)); } + @Override + public void configureGateway(GatewayConfigurationBuilder configurationBuilder) { + super.configureGateway(configurationBuilder); + // create a renewable token so the plugin does not start panicking + Container.ExecResult execResult; + try { + execResult = vaultContainer.execInContainer("vault", "token", "create", "-period=10m", "-field", "token"); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + String token = execResult.getStdout(); + configurationBuilder.setYamlProperty("api.secrets.providers[0].plugin", "vault"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.enabled", true); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.host", vaultContainer.getHost()); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.port", vaultContainer.getMappedPort(8200)); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.ssl.enabled", "false"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.auth.method", "token"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.auth.config.token", token); + try { + vaultContainer.execInContainer("vault", "kv", "put", "secret/rabbitmq", "host=" + rabbitmqContainer.getHost()); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + } + + @Override + public void configureSecretProviders( + Set, ? extends SecretManagerConfiguration>> secretProviderPlugins + ) { + secretProviderPlugins.add( + SecretProviderBuilder.build(HCVaultSecretProvider.PLUGIN_ID, HCVaultSecretProviderFactory.class, VaultConfig.class) + ); + } + + @Override + public void configureServices(Set>> services) { + super.configureServices(services); + services.add(SecretsService.class); + } + @Test @DeployApi({ "/apis/v4/messages/http-get/http-get-entrypoint-rabbitmq-endpoint.json" }) void should_receive_messages(HttpClient client) { @@ -69,6 +136,29 @@ void should_receive_messages(HttpClient client) { }); } + @Test + @DeployApi({ "/apis/v4/messages/http-get/http-get-entrypoint-rabbitmq-endpoint-secret.json" }) + void should_receive_messages_with_secret(HttpClient client) { + client + .rxRequest(HttpMethod.GET, "/test-secret") + .flatMap(request -> { + request.putHeader(HttpHeaderNames.ACCEPT.toString(), MediaType.APPLICATION_JSON); + return request.send(); + }) + .doOnSuccess(response -> assertThat(response.statusCode()).isEqualTo(200)) + .flatMap(response -> publishToRabbitMQ(exchange, routingKey, List.of("message")).andThen(response.body())) + .test() + .awaitDone(30, TimeUnit.SECONDS) + .assertValue(body -> { + final JsonObject jsonResponse = new JsonObject(body.toString()); + final JsonArray items = jsonResponse.getJsonArray("items"); + assertThat(items).hasSize(1); + final JsonObject message = items.getJsonObject(0); + assertThat(message.getString("content")).isEqualTo("message"); + return true; + }); + } + @EnumSource(value = Qos.class, names = { "AT_MOST_ONCE", "AT_LEAST_ONCE" }) @ParameterizedTest(name = "should receive 400 bad request with {0} qos") @DeployApi( diff --git a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointSolaceEndpointIntegrationTest.java b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointSolaceEndpointIntegrationTest.java index b3f99fcaf16..96afc35384d 100644 --- a/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointSolaceEndpointIntegrationTest.java +++ b/gravitee-apim-integration-tests/src/test/java/io/gravitee/apim/integration/tests/messages/httpget/HttpGetEntrypointSolaceEndpointIntegrationTest.java @@ -18,31 +18,47 @@ import static org.assertj.core.api.Assertions.assertThat; import com.graviteesource.entrypoint.http.get.HttpGetEntrypointConnectorFactory; +import com.graviteesource.secretprovider.hcvault.HCVaultSecretProvider; +import com.graviteesource.secretprovider.hcvault.HCVaultSecretProviderFactory; +import com.graviteesource.secretprovider.hcvault.config.manager.VaultConfig; +import com.graviteesource.service.secrets.SecretsService; import com.solace.messaging.publisher.DirectMessagePublisher; import com.solace.messaging.publisher.OutboundMessage; import com.solace.messaging.publisher.OutboundMessageBuilder; import com.solace.messaging.resources.Topic; import io.gravitee.apim.gateway.tests.sdk.annotations.DeployApi; import io.gravitee.apim.gateway.tests.sdk.annotations.GatewayTest; +import io.gravitee.apim.gateway.tests.sdk.configuration.GatewayConfigurationBuilder; import io.gravitee.apim.gateway.tests.sdk.connector.EntrypointBuilder; +import io.gravitee.apim.gateway.tests.sdk.secrets.SecretProviderBuilder; import io.gravitee.apim.integration.tests.messages.AbstractSolaceEndpointIntegrationTest; import io.gravitee.common.http.MediaType; +import io.gravitee.common.service.AbstractService; import io.gravitee.gateway.api.http.HttpHeaderNames; import io.gravitee.gateway.reactive.api.qos.Qos; +import io.gravitee.node.secrets.plugins.SecretProviderPlugin; import io.gravitee.plugin.entrypoint.EntrypointConnectorPlugin; +import io.gravitee.secrets.api.plugin.SecretManagerConfiguration; +import io.gravitee.secrets.api.plugin.SecretProviderFactory; import io.reactivex.rxjava3.core.Completable; import io.vertx.core.http.HttpMethod; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.rxjava3.core.http.HttpClient; import io.vertx.rxjava3.core.http.HttpClientResponse; +import java.io.IOException; import java.util.Map; +import java.util.Set; import java.util.concurrent.TimeUnit; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; +import org.testcontainers.containers.Container; +import org.testcontainers.solace.Service; +import org.testcontainers.vault.VaultContainer; /** * @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) @@ -52,11 +68,63 @@ @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) class HttpGetEntrypointSolaceEndpointIntegrationTest extends AbstractSolaceEndpointIntegrationTest { + private static final String VAULT_TOKEN = java.util.UUID.randomUUID().toString(); + + @org.testcontainers.junit.jupiter.Container + protected static final VaultContainer vaultContainer = new VaultContainer<>("hashicorp/vault:1.13.3") + .withVaultToken(VAULT_TOKEN) + .dependsOn(solaceContainer); + + @AfterAll + static void cleanup() { + vaultContainer.close(); + } + @Override public void configureEntrypoints(Map> entrypoints) { entrypoints.putIfAbsent("http-get", EntrypointBuilder.build("http-get", HttpGetEntrypointConnectorFactory.class)); } + @Override + public void configureGateway(GatewayConfigurationBuilder configurationBuilder) { + super.configureGateway(configurationBuilder); + // create a renewable token so the plugin does not start panicking + Container.ExecResult execResult; + try { + execResult = vaultContainer.execInContainer("vault", "token", "create", "-period=10m", "-field", "token"); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + String token = execResult.getStdout(); + configurationBuilder.setYamlProperty("api.secrets.providers[0].plugin", "vault"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.enabled", true); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.host", vaultContainer.getHost()); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.port", vaultContainer.getMappedPort(8200)); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.ssl.enabled", "false"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.auth.method", "token"); + configurationBuilder.setYamlProperty("api.secrets.providers[0].configuration.auth.config.token", token); + try { + vaultContainer.execInContainer("vault", "kv", "put", "secret/solace", "url=" + solaceContainer.getOrigin(Service.SMF)); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + } + + @Override + public void configureSecretProviders( + Set, ? extends SecretManagerConfiguration>> secretProviderPlugins + ) { + secretProviderPlugins.add( + SecretProviderBuilder.build(HCVaultSecretProvider.PLUGIN_ID, HCVaultSecretProviderFactory.class, VaultConfig.class) + ); + } + + @Override + public void configureServices(Set>> services) { + super.configureServices(services); + services.add(SecretsService.class); + } + @Test @DeployApi({ "/apis/v4/messages/http-get/http-get-entrypoint-solace-endpoint.json" }) void should_receive_messages(HttpClient client) { @@ -94,6 +162,43 @@ void should_receive_messages(HttpClient client) { }); } + @Test + @DeployApi({ "/apis/v4/messages/http-get/http-get-entrypoint-solace-endpoint-secret.json" }) + void should_receive_messages_with_secret(HttpClient client) { + client + .rxRequest(HttpMethod.GET, "/test-secret") + .flatMap(request -> { + request.putHeader(HttpHeaderNames.ACCEPT.toString(), MediaType.APPLICATION_JSON); + return request.send(); + }) + .doOnSuccess(response -> assertThat(response.statusCode()).isEqualTo(200)) + .flatMap(response -> { + final DirectMessagePublisher publisher = messagingService.createDirectMessagePublisherBuilder().build(); + return Completable + .fromCompletionStage(publisher.startAsync()) + .andThen( + Completable.fromRunnable(() -> { + Topic topic1 = Topic.of(topic); + OutboundMessageBuilder messageBuilder = messagingService.messageBuilder(); + messageBuilder.withProperty("key", "value"); + OutboundMessage outboundMessage = messageBuilder.build("message".getBytes()); + publisher.publish(outboundMessage, topic1); + }) + ) + .andThen(response.body()); + }) + .test() + .awaitDone(30, TimeUnit.SECONDS) + .assertValue(body -> { + final JsonObject jsonResponse = new JsonObject(body.toString()); + final JsonArray items = jsonResponse.getJsonArray("items"); + assertThat(items).hasSize(1); + final JsonObject message = items.getJsonObject(0); + assertThat(message.getString("content")).isEqualTo("message"); + return true; + }); + } + @EnumSource(value = Qos.class, names = { "AT_MOST_ONCE", "AT_LEAST_ONCE" }) @ParameterizedTest(name = "should receive 400 bad request with {0} qos") @DeployApi( diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/http-get/http-get-entrypoint-rabbitmq-endpoint-secret.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/http-get/http-get-entrypoint-rabbitmq-endpoint-secret.json new file mode 100644 index 00000000000..f73489e2308 --- /dev/null +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/http-get/http-get-entrypoint-rabbitmq-endpoint-secret.json @@ -0,0 +1,72 @@ +{ + "id": "http-get-entrypoint-rabbitmq-endpoint", + "name": "http-get-entrypoint-rabbitmq-endpoint", + "apiVersion": "1.0", + "definitionVersion": "4.0.0", + "type": "message", + "description": "http-get-entrypoint-rabbitmq-endpoint", + "listeners": [ + { + "type": "http", + "paths": [ + { + "path": "/test-secret" + } + ], + "entrypoints": [ + { + "type": "http-get", + "configuration": { + "messagesLimitCount": 1, + "messagesLimitDurationMs": 10000, + "headersInPayload": true, + "metadataInPayload": true + } + } + ] + } + ], + "endpointGroups": [ + { + "name": "default-group", + "type": "rabbitmq", + "endpoints": [ + { + "name": "default", + "type": "rabbitmq", + "weight": 1, + "inheritConfiguration": false, + "configuration": { + "serverHost": "{#secrets.get('/vault/secret/rabbitmq:host')}", + "serverPort": 5672 + }, + "sharedConfigurationOverride": { + "security": { + "auth": { + "username": "admin", + "password": "admin" + } + }, + "producer": { + "enabled": false + }, + "consumer": { + "enabled": true, + "routingKey": "a.routing.key", + "exchange": { + "name": "my-exchange", + "type": "topic", + "durable": false, + "autoDelete": true + } + } + } + } + ] + } + ], + "flows": [], + "analytics": { + "enabled": false + } +} diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/http-get/http-get-entrypoint-solace-endpoint-secret.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/http-get/http-get-entrypoint-solace-endpoint-secret.json new file mode 100644 index 00000000000..85a52393307 --- /dev/null +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/http-get/http-get-entrypoint-solace-endpoint-secret.json @@ -0,0 +1,63 @@ +{ + "id": "http-get-entrypoint-mqtt5-endpoint", + "name": "my-api", + "apiVersion": "1.0", + "definitionVersion": "4.0.0", + "type": "message", + "description": "api v4 using HTTP Get entrypoint", + "listeners": [ + { + "type": "http", + "paths": [ + { + "path": "/test-secret" + } + ], + "entrypoints": [ + { + "type": "http-get", + "configuration": { + "messagesLimitCount": 1, + "messagesLimitDurationMs": 10000, + "headersInPayload": true, + "metadataInPayload": true + } + } + ] + } + ], + "endpointGroups": [ + { + "name": "default-group", + "type": "solace", + "endpoints": [ + { + "name": "default", + "type": "solace", + "weight": 1, + "inheritConfiguration": false, + "configuration": { + "url": "{#secrets.get('/vault/secret/solace:url')}", + "vpnName": "default" + }, + "sharedConfigurationOverride": { + "consumer": { + "enabled": true, + "topics": ["test-topic"] + }, + "security": { + "auth" : { + "username" : "admin", + "password" : "admin" + } + } + } + } + ] + } + ], + "flows": [], + "analytics": { + "enabled": false + } +} diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-publish.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-publish.json index b112ddb7c17..9f4c4f39d5b 100644 --- a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-publish.json +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-publish.json @@ -37,7 +37,7 @@ "weight": 1, "inheritConfiguration": false, "configuration": { - "serverHost": "localhost", + "serverHost": "mqtt5-host", "serverPort": "mqtt5-port" }, "sharedConfigurationOverride": { diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-least-once.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-least-once.json index bbb2d75a96b..ddd0cb3c28f 100644 --- a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-least-once.json +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-least-once.json @@ -51,7 +51,7 @@ "weight": 1, "inheritConfiguration": false, "configuration": { - "serverHost": "localhost", + "serverHost": "mqtt5-host", "serverPort": "mqtt5-port" }, "sharedConfigurationOverride": { diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-most-once.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-most-once.json index 0cf02259820..f50ba64daa8 100644 --- a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-most-once.json +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-at-most-once.json @@ -51,7 +51,7 @@ "weight": 1, "inheritConfiguration": false, "configuration": { - "serverHost": "localhost", + "serverHost": "mqtt5-host", "serverPort": "mqtt5-port" }, "sharedConfigurationOverride": { diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-auto.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-auto.json index 43dccfb4874..8ca7170bbec 100644 --- a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-auto.json +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-auto.json @@ -63,7 +63,7 @@ "weight": 1, "inheritConfiguration": false, "configuration": { - "serverHost": "localhost", + "serverHost": "mqtt5-host", "serverPort": "mqtt5-port" }, "sharedConfigurationOverride": { diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-none.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-none.json index 12401e22e9f..f472cbce5eb 100644 --- a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-none.json +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-qos-none.json @@ -63,7 +63,7 @@ "weight": 1, "inheritConfiguration": false, "configuration": { - "serverHost": "localhost", + "serverHost": "mqtt5-host", "serverPort": "mqtt5-port" }, "sharedConfigurationOverride": { diff --git a/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-secret.json b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-secret.json new file mode 100644 index 00000000000..9ec859d7af5 --- /dev/null +++ b/gravitee-apim-integration-tests/src/test/resources/apis/v4/messages/mqtt5/mqtt5-endpoint-secret.json @@ -0,0 +1,101 @@ +{ + "id": "mqtt5-endpoint-qos-auto", + "name": "my-api", + "apiVersion": "1.0", + "definitionVersion": "4.0.0", + "type": "message", + "description": "api v4 using HTTP Get entrypoint", + "listeners": [ + { + "type": "subscription", + "entrypoints": [ + { + "type": "webhook" + } + ] + }, + { + "type": "http", + "paths": [ + { + "path": "/test-secret" + } + ], + "entrypoints": [ + { + "type": "http-get", + "qos": "auto", + "configuration": { + "messagesLimitCount": 10, + "messagesLimitDurationMs": 10000, + "headersInPayload": false, + "metadataInPayload": false + } + }, + { + "type": "sse", + "qos": "auto", + "configuration": {} + }, + { + "type": "websocket", + "qos": "auto", + "configuration": { + "publisher": { + "enabled": true + }, + "subscriber": { + "enabled": true + } + } + } + ] + } + ], + "endpointGroups": [ + { + "name": "default-group", + "type": "mqtt5", + "endpoints": [ + { + "name": "default", + "type": "mqtt5", + "weight": 1, + "inheritConfiguration": false, + "configuration": { + "serverHost": "{#secrets.get('/vault/secret/mqtt5:host')}", + "serverPort": "mqtt5-port" + }, + "sharedConfigurationOverride": { + "consumer": { + "enabled": true, + "topic": "test-topic-secret" + }, + "producer": { + "enabled": true, + "topic": "test-topic-secret" + }, + "sessionExpiryInterval": 3600 + } + } + ] + } + ], + "flows": [ + { + "name": "Flow ready", + "enabled": true, + "subscribe": [ + { + "name": "Message Flow Ready", + "description": "Detect the message flow is ready", + "enabled": true, + "policy": "message-flow-ready" + } + ] + } + ], + "analytics": { + "enabled": false + } +} diff --git a/pom.xml b/pom.xml index 3f88358e3ef..ef3e13beba8 100644 --- a/pom.xml +++ b/pom.xml @@ -274,9 +274,9 @@ 4.0.1 2.0.0 4.0.1 - 3.0.0 - 2.0.0 - 2.0.0 + 4.0.1 + 3.0.1 + 3.0.0 1.0.1 1.0.2 3.1.0