From 26b29803f7faf0506c3c0bd5e5368e772083f481 Mon Sep 17 00:00:00 2001 From: Vincent Sevel Date: Wed, 11 Oct 2023 18:47:46 +0200 Subject: [PATCH] Quarkus 3.5.0.CR1 + Don't use VertxRecorder to get Vertx instance --- .../ROOT/pages/includes/attributes.adoc | 2 +- integration-tests/vault/pom.xml | 10 +++++ .../java/io/quarkus/vault/VaultPKIITCase.java | 42 +++++++++---------- pom.xml | 2 +- .../client/SharedVertxVaultClient.java | 10 ++--- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/docs/modules/ROOT/pages/includes/attributes.adoc b/docs/modules/ROOT/pages/includes/attributes.adoc index 3ef2a6df..cc180aca 100644 --- a/docs/modules/ROOT/pages/includes/attributes.adoc +++ b/docs/modules/ROOT/pages/includes/attributes.adoc @@ -1,4 +1,4 @@ -:quarkus-version: 3.4.2 +:quarkus-version: 3.5.0.CR1 :quarkus-vault-version: 3.2.0 :maven-version: 3.8.1+ diff --git a/integration-tests/vault/pom.xml b/integration-tests/vault/pom.xml index 65b5f636..77d40b15 100644 --- a/integration-tests/vault/pom.xml +++ b/integration-tests/vault/pom.xml @@ -12,6 +12,16 @@ Quarkus - Vault - Integration Tests + + org.bouncycastle + bcprov-jdk18on + test + + + org.bouncycastle + bcpkix-jdk18on + test + io.quarkus quarkus-junit5-internal diff --git a/integration-tests/vault/src/test/java/io/quarkus/vault/VaultPKIITCase.java b/integration-tests/vault/src/test/java/io/quarkus/vault/VaultPKIITCase.java index 487c6665..091011fd 100644 --- a/integration-tests/vault/src/test/java/io/quarkus/vault/VaultPKIITCase.java +++ b/integration-tests/vault/src/test/java/io/quarkus/vault/VaultPKIITCase.java @@ -4,16 +4,16 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toList; +import static org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers.pkcs_9_at_extensionRequest; +import static org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers.rsaEncryption; +import static org.bouncycastle.asn1.x509.Extension.nameConstraints; +import static org.bouncycastle.asn1.x509.Extension.subjectAlternativeName; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.testcontainers.shaded.org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers.pkcs_9_at_extensionRequest; -import static org.testcontainers.shaded.org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers.rsaEncryption; -import static org.testcontainers.shaded.org.bouncycastle.asn1.x509.Extension.nameConstraints; -import static org.testcontainers.shaded.org.bouncycastle.asn1.x509.Extension.subjectAlternativeName; import java.io.StringReader; import java.math.BigInteger; @@ -27,23 +27,23 @@ import jakarta.inject.Inject; +import org.bouncycastle.asn1.ASN1Encodable; +import org.bouncycastle.asn1.x509.BasicConstraints; +import org.bouncycastle.asn1.x509.Extensions; +import org.bouncycastle.asn1.x509.GeneralName; +import org.bouncycastle.asn1.x509.GeneralNames; +import org.bouncycastle.asn1.x509.GeneralSubtree; +import org.bouncycastle.asn1.x509.NameConstraints; +import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; +import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; +import org.bouncycastle.cert.X509CertificateHolder; +import org.bouncycastle.openssl.PEMParser; +import org.bouncycastle.pkcs.PKCS10CertificationRequest; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; -import org.testcontainers.shaded.org.bouncycastle.asn1.ASN1Encodable; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.BasicConstraints; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.Extensions; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.GeneralName; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.GeneralNames; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.GeneralSubtree; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.NameConstraints; -import org.testcontainers.shaded.org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; -import org.testcontainers.shaded.org.bouncycastle.asn1.x9.X9ObjectIdentifiers; -import org.testcontainers.shaded.org.bouncycastle.cert.X509CertificateHolder; -import org.testcontainers.shaded.org.bouncycastle.openssl.PEMParser; -import org.testcontainers.shaded.org.bouncycastle.pkcs.PKCS10CertificationRequest; import io.quarkus.test.QuarkusUnitTest; import io.quarkus.test.common.QuarkusTestResource; @@ -168,7 +168,7 @@ public void testGenerateRootOptions() throws Exception { .map(GeneralName::getName) .map(ASN1Encodable::toString) .collect(toList()); - assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [0]test]", "alt.example.com", "#01020304", "ex:12345"), + assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [CONTEXT 0]test]", "alt.example.com", "#01020304", "ex:12345"), subjectAlternativeNames); // Check timeToLive option @@ -268,7 +268,7 @@ public void testGenerateIntermediateCSROptions() throws Exception { .map(GeneralName::getName) .map(ASN1Encodable::toString) .collect(toList()); - assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [0]test]", "alt.example.com", "#01020304", "ex:12345"), + assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [CONTEXT 0]test]", "alt.example.com", "#01020304", "ex:12345"), subjectAlternativeNames); // Check keyType option @@ -598,7 +598,7 @@ public void testGenerateCertificate() throws Exception { .map(GeneralName::getName) .map(ASN1Encodable::toString) .collect(toList()); - assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [0]test]", "alt.example.com", "#01020304", "ex:12345"), + assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [CONTEXT 0]test]", "alt.example.com", "#01020304", "ex:12345"), subjectAlternativeNames); // Check timeToLive option @@ -678,7 +678,7 @@ public void testGenerateCertificateDer() throws Exception { .map(GeneralName::getName) .map(ASN1Encodable::toString) .collect(toList()); - assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [0]test]", "alt.example.com", "#01020304", "ex:12345"), + assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [CONTEXT 0]test]", "alt.example.com", "#01020304", "ex:12345"), subjectAlternativeNames); // Check timeToLive option @@ -777,7 +777,7 @@ public void testSignCSR() throws Exception { .map(GeneralName::getName) .map(ASN1Encodable::toString) .collect(toList()); - assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [0]test]", "alt.example.com", "#01020304", "ex:12345"), + assertEquals(asList("[1.3.6.1.4.1.311.20.2.3, [CONTEXT 0]test]", "alt.example.com", "#01020304", "ex:12345"), subjectAlternativeNames); // Check timeToLive option diff --git a/pom.xml b/pom.xml index 0da1c19a..afac4999 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 11 UTF-8 UTF-8 - 3.4.2 + 3.5.0.CR1 1.2.3 3.24.2 3.0.1 diff --git a/runtime/src/main/java/io/quarkus/vault/runtime/client/SharedVertxVaultClient.java b/runtime/src/main/java/io/quarkus/vault/runtime/client/SharedVertxVaultClient.java index 68ca2692..c4d51197 100644 --- a/runtime/src/main/java/io/quarkus/vault/runtime/client/SharedVertxVaultClient.java +++ b/runtime/src/main/java/io/quarkus/vault/runtime/client/SharedVertxVaultClient.java @@ -7,6 +7,7 @@ import jakarta.annotation.PreDestroy; import jakarta.enterprise.context.Dependent; +import jakarta.enterprise.inject.Instance; import jakarta.enterprise.inject.Produces; import jakarta.inject.Singleton; @@ -14,7 +15,6 @@ import io.quarkus.runtime.TlsConfig; import io.quarkus.vault.VaultException; import io.quarkus.vault.runtime.VaultConfigHolder; -import io.quarkus.vertx.runtime.VertxEventBusConsumerRecorder; import io.vertx.mutiny.core.Vertx; import io.vertx.mutiny.ext.web.client.WebClient; @@ -24,9 +24,9 @@ public class SharedVertxVaultClient extends VertxVaultClient { @Produces @Dependent - public static VertxVaultClient createSharedVaultClient() { + public static VertxVaultClient createSharedVaultClient(Instance vertx) { Annotation clientType; - if (VertxEventBusConsumerRecorder.getVertx() != null) { + if (vertx.isResolvable()) { clientType = Shared.Literal.INSTANCE; } else { clientType = Private.Literal.INSTANCE; @@ -36,11 +36,11 @@ public static VertxVaultClient createSharedVaultClient() { private final AtomicReference webClient = new AtomicReference<>(); - public SharedVertxVaultClient(VaultConfigHolder vaultConfigHolder, TlsConfig tlsConfig) { + public SharedVertxVaultClient(VaultConfigHolder vaultConfigHolder, Vertx quarkusMutinyVertx, TlsConfig tlsConfig) { super(vaultConfigHolder.getVaultRuntimeConfig().url().orElseThrow(() -> new VaultException("no vault url provided")), vaultConfigHolder.getVaultRuntimeConfig().enterprise().namespace(), vaultConfigHolder.getVaultRuntimeConfig().readTimeout()); - Vertx vertx = Vertx.newInstance(VertxEventBusConsumerRecorder.getVertx()); + Vertx vertx = Vertx.newInstance(quarkusMutinyVertx.getDelegate()); this.webClient.set(createHttpClient(vertx, vaultConfigHolder.getVaultRuntimeConfig(), tlsConfig)); }