diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/GRPCIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/GRPCIT.java index e251cf25c..fc20ab3ff 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/GRPCIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/GRPCIT.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.grpc.Channel; +import io.quarkus.test.bootstrap.CloseableManagedChannel; import io.quarkus.test.bootstrap.RestService; import io.quarkus.ts.grpc.GreeterGrpc; import io.quarkus.ts.grpc.HelloReply; @@ -21,7 +21,7 @@ public interface GRPCIT { RestService app(); - Channel getChannel(); + CloseableManagedChannel getChannel(); @Test default void grpcClient() { @@ -32,20 +32,24 @@ default void grpcClient() { @Test default void grpcServer() throws ExecutionException, InterruptedException { - HelloRequest request = HelloRequest.newBuilder().setName("server").build(); - HelloReply response = GreeterGrpc.newFutureStub(getChannel()).sayHello(request).get(); - Assertions.assertEquals("Hello server", response.getMessage()); + try (var channel = getChannel()) { + HelloRequest request = HelloRequest.newBuilder().setName("server").build(); + HelloReply response = GreeterGrpc.newFutureStub(channel).sayHello(request).get(); + Assertions.assertEquals("Hello server", response.getMessage()); + } } @Test default void serverStream() { - HelloRequest request = HelloRequest.newBuilder().setName("ServerStream").build(); - Iterator stream = StreamingGrpc.newBlockingStub(getChannel()).serverStream(request); - AtomicInteger counter = new AtomicInteger(0); - stream.forEachRemaining((reply) -> { - Assertions.assertEquals("Hello ServerStream", reply.getMessage()); - counter.incrementAndGet(); - }); - Assertions.assertEquals(GrpcStreamingService.SERVER_STREAM_MESSAGES_COUNT, counter.get()); + try (var channel = getChannel()) { + HelloRequest request = HelloRequest.newBuilder().setName("ServerStream").build(); + Iterator stream = StreamingGrpc.newBlockingStub(channel).serverStream(request); + AtomicInteger counter = new AtomicInteger(0); + stream.forEachRemaining((reply) -> { + Assertions.assertEquals("Hello ServerStream", reply.getMessage()); + counter.incrementAndGet(); + }); + Assertions.assertEquals(GrpcStreamingService.SERVER_STREAM_MESSAGES_COUNT, counter.get()); + } } } diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftExtensionGRPCIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftExtensionGRPCIT.java index 5a89f396e..ec56a549b 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftExtensionGRPCIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftExtensionGRPCIT.java @@ -3,7 +3,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; -import io.grpc.Channel; +import io.quarkus.test.bootstrap.CloseableManagedChannel; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.OpenShiftDeploymentStrategy; import io.quarkus.test.scenarios.OpenShiftScenario; @@ -19,7 +19,7 @@ public RestService app() { } @Override - public Channel getChannel() { + public CloseableManagedChannel getChannel() { return null; } } diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftGRPCIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftGRPCIT.java index e6be7d08d..b6a436f11 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftGRPCIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/OpenShiftGRPCIT.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.Disabled; -import io.grpc.Channel; +import io.quarkus.test.bootstrap.CloseableManagedChannel; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.OpenShiftScenario; @@ -16,7 +16,7 @@ public RestService app() { } @Override - public Channel getChannel() { + public CloseableManagedChannel getChannel() { return null; } } diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/ReflectionHttpIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/ReflectionHttpIT.java index 2b544b547..fd0d12e66 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/ReflectionHttpIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/ReflectionHttpIT.java @@ -15,7 +15,6 @@ import com.google.protobuf.Descriptors; import com.google.protobuf.InvalidProtocolBufferException; -import io.grpc.Channel; import io.grpc.reflection.v1.FileDescriptorResponse; import io.quarkus.test.bootstrap.RestService; import io.quarkus.ts.grpc.GreeterGrpc; @@ -26,8 +25,6 @@ public interface ReflectionHttpIT { RestService app(); - Channel getChannel(); - @Test default void testReflectionServices() { GrpcReflectionResponse response = app().given().when().get("/http/reflection/service/info") diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/SameServerIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/SameServerIT.java index 2f288b7cc..58c431039 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/SameServerIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/SameServerIT.java @@ -1,10 +1,6 @@ package io.quarkus.ts.http.grpc; -import org.junit.jupiter.api.AfterAll; - -import io.grpc.Channel; -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; +import io.quarkus.test.bootstrap.CloseableManagedChannel; import io.quarkus.test.bootstrap.GrpcService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; @@ -15,18 +11,10 @@ public class SameServerIT implements GRPCIT, ReflectionHttpIT, StreamingHttpIT { @QuarkusApplication(grpc = true) static final GrpcService app = new GrpcService(); - private static ManagedChannel channel; @Override - public Channel getChannel() { - if (channel == null) { - channel = ManagedChannelBuilder.forAddress( - app.getURI().getHost(), - app.getURI().getPort()) - .usePlaintext() - .build(); - } - return channel; + public CloseableManagedChannel getChannel() { + return app.grpcChannel(); } @Override @@ -34,8 +22,4 @@ public RestService app() { return app; } - @AfterAll - static void afterAll() { - channel.shutdown(); - } } diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/XeparateServerIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/SeparateServerIT.java similarity index 66% rename from http/grpc/src/test/java/io/quarkus/ts/http/grpc/XeparateServerIT.java rename to http/grpc/src/test/java/io/quarkus/ts/http/grpc/SeparateServerIT.java index 63a30477a..f44275503 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/XeparateServerIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/SeparateServerIT.java @@ -1,17 +1,13 @@ package io.quarkus.ts.http.grpc; -import org.junit.jupiter.api.DisplayName; - -import io.grpc.Channel; +import io.quarkus.test.bootstrap.CloseableManagedChannel; import io.quarkus.test.bootstrap.GrpcService; import io.quarkus.test.bootstrap.RestService; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.QuarkusApplication; @QuarkusScenario -@DisplayName("SeparateServer") -//This test should be the last, or we get complains, that the channel was not shut down before closure. This is a bug in our framework. -public class XeparateServerIT implements GRPCIT, StreamingHttpIT, ReflectionHttpIT { +public class SeparateServerIT implements GRPCIT, StreamingHttpIT, ReflectionHttpIT { @QuarkusApplication(grpc = true) static final GrpcService app = (GrpcService) new GrpcService() @@ -19,7 +15,7 @@ public class XeparateServerIT implements GRPCIT, StreamingHttpIT, ReflectionHttp .withProperty("quarkus.grpc.clients.plain.port", "${quarkus.grpc.server.port}"); @Override - public Channel getChannel() { + public CloseableManagedChannel getChannel() { return app.grpcChannel(); } diff --git a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/TLSIT.java b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/TLSIT.java index bf985cd8c..631b397cd 100644 --- a/http/grpc/src/test/java/io/quarkus/ts/http/grpc/TLSIT.java +++ b/http/grpc/src/test/java/io/quarkus/ts/http/grpc/TLSIT.java @@ -3,13 +3,10 @@ import java.io.IOException; import java.io.InputStream; -import org.junit.jupiter.api.AfterAll; - -import io.grpc.Channel; import io.grpc.ChannelCredentials; import io.grpc.Grpc; -import io.grpc.ManagedChannel; import io.grpc.TlsChannelCredentials; +import io.quarkus.test.bootstrap.CloseableManagedChannel; import io.quarkus.test.bootstrap.GrpcService; import io.quarkus.test.bootstrap.Protocol; import io.quarkus.test.bootstrap.RestService; @@ -20,23 +17,19 @@ @QuarkusScenario public class TLSIT implements GRPCIT, StreamingHttpIT, ReflectionHttpIT { - private static ManagedChannel channel; @QuarkusApplication(grpc = true, ssl = true) static final GrpcService app = (GrpcService) new GrpcService() .withProperty("quarkus.profile", "ssl"); - public Channel getChannel() { - if (channel != null) { - return channel; - } + public CloseableManagedChannel getChannel() { try (InputStream caCertificate = app.getClass().getClassLoader().getResourceAsStream("tls/ca.pem")) { ChannelCredentials credentials = TlsChannelCredentials.newBuilder() .trustManager(caCertificate) .build(); - channel = Grpc.newChannelBuilderForAddress(app().getURI(Protocol.GRPC).getHost(), + var channel = Grpc.newChannelBuilderForAddress(app().getURI(Protocol.GRPC).getHost(), app().getURI(Protocol.HTTPS).getPort(), credentials) .build(); - return channel; + return new CloseableManagedChannel(channel); } catch (IOException e) { throw new RuntimeException(e); } @@ -52,8 +45,4 @@ public RequestSpecification given() { return app().relaxedHttps().given(); } - @AfterAll - static void afterAll() { - channel.shutdown(); - } } diff --git a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeGrpcIntegrationReactiveIT.java b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeGrpcIntegrationReactiveIT.java index 9517aae89..53227b6e5 100644 --- a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeGrpcIntegrationReactiveIT.java +++ b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeGrpcIntegrationReactiveIT.java @@ -24,7 +24,6 @@ import io.quarkus.test.bootstrap.Protocol; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.DevModeQuarkusApplication; -import io.quarkus.test.services.URILike; @Tag("QUARKUS-1026") @Tag("QUARKUS-1094") @@ -49,13 +48,7 @@ public class DevModeGrpcIntegrationReactiveIT { }; @DevModeQuarkusApplication(grpc = true) - static final GrpcService app = (GrpcService) new GrpcService() { - @Override - public URILike getGrpcHost() { - // TODO: make app.grpcChannel() support gRPC on same HTTP server - return super.getGrpcHost().withPort(app.getURI().getPort()); - } - } + static final GrpcService app = (GrpcService) new GrpcService() .withProperty("quarkus.oidc.enabled", "false") .withProperty("quarkus.keycloak.policy-enforcer.enable", "false") .withProperty("quarkus.keycloak.devservices.enabled", "false"); @@ -63,9 +56,11 @@ public URILike getGrpcHost() { @Test public void testGrpcAsClient() throws ExecutionException, InterruptedException { HelloRequest request = HelloRequest.newBuilder().setName(NAME).build(); - HelloReply response = GreeterGrpc.newFutureStub(app.grpcChannel()).sayHello(request).get(); + try (var channel = app.grpcChannel()) { + HelloReply response = GreeterGrpc.newFutureStub(channel).sayHello(request).get(); - assertEquals("Hello " + NAME, response.getMessage()); + assertEquals("Hello " + NAME, response.getMessage()); + } } @Test diff --git a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeHttpsIT.java b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeHttpsIT.java index a0880978e..cf4d1af08 100644 --- a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeHttpsIT.java +++ b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/DevModeHttpsIT.java @@ -13,7 +13,7 @@ @QuarkusScenario public class DevModeHttpsIT extends AbstractDevModeIT { - @DevModeQuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true)) + @DevModeQuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, useTlsRegistry = false, configureHttpServer = true)) static RestService app = new DevModeQuarkusService() .withProperty("quarkus.oidc.enabled", "false") .withProperty("quarkus.keycloak.policy-enforcer.enable", "false") diff --git a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/Http2IT.java b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/Http2IT.java index 49319ba76..60be936cb 100644 --- a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/Http2IT.java +++ b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/Http2IT.java @@ -43,7 +43,7 @@ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class Http2IT { @QuarkusApplication(ssl = true, classes = { MorningResource.class, - CustomFramesResource.class }, properties = "http2.properties", certificates = @Certificate(configureKeystore = true)) + CustomFramesResource.class }, properties = "http2.properties", certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false)) static RestService app = new RestService(); private static URILike baseUri; diff --git a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/HttpAdvancedReactiveIT.java b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/HttpAdvancedReactiveIT.java index 06fb08a72..544b8cdba 100644 --- a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/HttpAdvancedReactiveIT.java +++ b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/HttpAdvancedReactiveIT.java @@ -19,7 +19,7 @@ public class HttpAdvancedReactiveIT extends BaseHttpAdvancedReactiveIT { static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH) .withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false"); - @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true)) + @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false)) static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url", keycloak::getRealmUrl); diff --git a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/OpenShiftHttpAdvancedReactiveIT.java b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/OpenShiftHttpAdvancedReactiveIT.java index 515e55968..f7ec17339 100644 --- a/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/OpenShiftHttpAdvancedReactiveIT.java +++ b/http/http-advanced-reactive/src/test/java/io/quarkus/ts/http/advanced/reactive/OpenShiftHttpAdvancedReactiveIT.java @@ -23,7 +23,7 @@ public class OpenShiftHttpAdvancedReactiveIT extends BaseHttpAdvancedReactiveIT static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH) .withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false"); - @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true)) + @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false)) static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url", keycloak::getRealmUrl); diff --git a/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/DevModeGrpcIntegrationIT.java b/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/DevModeGrpcIntegrationIT.java index 7a3d5b323..e1a057dca 100644 --- a/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/DevModeGrpcIntegrationIT.java +++ b/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/DevModeGrpcIntegrationIT.java @@ -23,7 +23,6 @@ import io.quarkus.test.bootstrap.Protocol; import io.quarkus.test.scenarios.QuarkusScenario; import io.quarkus.test.services.DevModeQuarkusApplication; -import io.quarkus.test.services.URILike; @Tag("QUARKUS-1026") @Tag("QUARKUS-1094") @@ -47,13 +46,7 @@ public class DevModeGrpcIntegrationIT { }; @DevModeQuarkusApplication(grpc = true) - static final GrpcService app = (GrpcService) new GrpcService() { - @Override - public URILike getGrpcHost() { - // TODO: make app.grpcChannel() support gRPC on same HTTP server - return super.getGrpcHost().withPort(app.getURI().getPort()); - } - } + static final GrpcService app = (GrpcService) new GrpcService() .withProperty("quarkus.oidc.enabled", "false") .withProperty("quarkus.keycloak.policy-enforcer.enable", "false") .withProperty("quarkus.keycloak.devservices.enabled", "false"); @@ -61,9 +54,11 @@ public URILike getGrpcHost() { @Test public void testGrpcAsClient() { HelloRequest request = HelloRequest.newBuilder().setName(NAME).build(); - HelloReply response = GreeterGrpc.newBlockingStub(app.grpcChannel()).sayHello(request); + try (var channel = app.grpcChannel()) { + HelloReply response = GreeterGrpc.newBlockingStub(channel).sayHello(request); - assertEquals("Hello " + NAME, response.getMessage()); + assertEquals("Hello " + NAME, response.getMessage()); + } } @Test diff --git a/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/HttpAdvancedIT.java b/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/HttpAdvancedIT.java index 7a9c33ade..ec5e8d810 100644 --- a/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/HttpAdvancedIT.java +++ b/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/HttpAdvancedIT.java @@ -19,7 +19,7 @@ public class HttpAdvancedIT extends BaseHttpAdvancedIT { static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH) .withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false"); - @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true)) + @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false)) static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url", keycloak::getRealmUrl); @Override diff --git a/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/OpenShiftHttpAdvancedIT.java b/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/OpenShiftHttpAdvancedIT.java index 1cfcd7199..f115e38b4 100644 --- a/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/OpenShiftHttpAdvancedIT.java +++ b/http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/OpenShiftHttpAdvancedIT.java @@ -23,7 +23,7 @@ public class OpenShiftHttpAdvancedIT extends BaseHttpAdvancedIT { static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH) .withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false"); - @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true)) + @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false)) static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url", keycloak::getRealmUrl); @Override diff --git a/http/management/src/test/java/io/quarkus/qe/LocalOptionsIT.java b/http/management/src/test/java/io/quarkus/qe/LocalOptionsIT.java index 331ea58af..50ca8e2f8 100644 --- a/http/management/src/test/java/io/quarkus/qe/LocalOptionsIT.java +++ b/http/management/src/test/java/io/quarkus/qe/LocalOptionsIT.java @@ -24,7 +24,7 @@ public class LocalOptionsIT { static final RestService custom = new RestService() .withProperty("quarkus.management.port", "9002"); - @QuarkusApplication(certificates = @Certificate(configureKeystoreForManagementInterface = true)) + @QuarkusApplication(certificates = @Certificate(configureManagementInterface = true, configureKeystore = true, useTlsRegistry = false)) static final RestService tls = new RestService() .withProperty("quarkus.management.port", "9003"); diff --git a/pom.xml b/pom.xml index 74741e1a4..069f7d675 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ io.quarkus 999-SNAPSHOT 3.14.1 - 1.6.0.Beta1 + 1.6.0.Beta2 2.6.1 7.5.1 2.24.1 diff --git a/security/https/src/test/java/io/quarkus/ts/security/https/enabled/EnabledHttpsSecurityIT.java b/security/https/src/test/java/io/quarkus/ts/security/https/enabled/EnabledHttpsSecurityIT.java index 801932120..bd3073a3c 100644 --- a/security/https/src/test/java/io/quarkus/ts/security/https/enabled/EnabledHttpsSecurityIT.java +++ b/security/https/src/test/java/io/quarkus/ts/security/https/enabled/EnabledHttpsSecurityIT.java @@ -20,7 +20,7 @@ public class EnabledHttpsSecurityIT { @QuarkusApplication(ssl = true, certificates = { - @Certificate(configureKeystore = true, configureTruststore = true, password = CLIENT_PASSWORD, clientCertificates = { + @Certificate(configureKeystore = true, configureTruststore = true, useTlsRegistry = false, configureHttpServer = true, password = CLIENT_PASSWORD, clientCertificates = { @Certificate.ClientCertificate(cnAttribute = CLIENT_CN), @Certificate.ClientCertificate(cnAttribute = UNKNOWN_CLIENT_CN, unknownToServer = true) }) diff --git a/security/https/src/test/java/io/quarkus/ts/security/https/redirect/RedirectHttpsSecurityIT.java b/security/https/src/test/java/io/quarkus/ts/security/https/redirect/RedirectHttpsSecurityIT.java index 107707941..6fa01e278 100644 --- a/security/https/src/test/java/io/quarkus/ts/security/https/redirect/RedirectHttpsSecurityIT.java +++ b/security/https/src/test/java/io/quarkus/ts/security/https/redirect/RedirectHttpsSecurityIT.java @@ -18,7 +18,7 @@ @QuarkusScenario public class RedirectHttpsSecurityIT { - @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureTruststore = true)) + @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureTruststore = true, configureHttpServer = true, useTlsRegistry = false)) static RestService app = new RestService() .withProperty("quarkus.http.insecure-requests", HttpConfiguration.InsecureRequests.REDIRECT.name()); diff --git a/security/https/src/test/java/io/quarkus/ts/security/https/secured/AuthzHttpsSecurityIT.java b/security/https/src/test/java/io/quarkus/ts/security/https/secured/AuthzHttpsSecurityIT.java index 57fcf88e9..0e00351d4 100644 --- a/security/https/src/test/java/io/quarkus/ts/security/https/secured/AuthzHttpsSecurityIT.java +++ b/security/https/src/test/java/io/quarkus/ts/security/https/secured/AuthzHttpsSecurityIT.java @@ -24,7 +24,7 @@ public class AuthzHttpsSecurityIT { private static final String SECURED_PATH = "/secured"; private static final String HELLO_FULL_PATH = "/hello/full"; - @QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureTruststore = true, password = CLIENT_PASSWORD, clientCertificates = { + @QuarkusApplication(ssl = true, certificates = @Certificate(useTlsRegistry = false, configureHttpServer = true, configureKeystore = true, configureTruststore = true, password = CLIENT_PASSWORD, clientCertificates = { @Certificate.ClientCertificate(cnAttribute = CLIENT_CN), @Certificate.ClientCertificate(cnAttribute = GUEST_CLIENT_CN), @Certificate.ClientCertificate(cnAttribute = UNKNOWN_CLIENT_CN, unknownToServer = true) diff --git a/security/vertx-jwt/src/test/java/io/quarkus/ts/security/vertx/AbstractCommonIT.java b/security/vertx-jwt/src/test/java/io/quarkus/ts/security/vertx/AbstractCommonIT.java index a8f9e9e49..65534b8c4 100644 --- a/security/vertx-jwt/src/test/java/io/quarkus/ts/security/vertx/AbstractCommonIT.java +++ b/security/vertx-jwt/src/test/java/io/quarkus/ts/security/vertx/AbstractCommonIT.java @@ -43,8 +43,8 @@ public abstract class AbstractCommonIT { static DefaultService redis = new DefaultService().withProperty("ALLOW_EMPTY_PASSWORD", "YES"); @QuarkusApplication(certificates = { - @Certificate(format = Certificate.Format.PEM, prefix = VALID_PEM_PREFIX), - @Certificate(format = Certificate.Format.PEM, prefix = INVALID_PEM_PREFIX) + @Certificate(format = Certificate.Format.PEM, prefix = VALID_PEM_PREFIX, configureHttpServer = true, useTlsRegistry = false), + @Certificate(format = Certificate.Format.PEM, prefix = INVALID_PEM_PREFIX, configureHttpServer = true, useTlsRegistry = false), }) static RestService app = new RestService() .withProperty("quarkus.redis.hosts", @@ -52,7 +52,7 @@ public abstract class AbstractCommonIT { String redisHost = redis.getURI().withScheme("redis").getRestAssuredStyleUri(); return String.format("%s:%d", redisHost, redis.getURI().getPort()); }) - .withProperty("authN.cert-path", AbstractCommonIT::getCertificatePath); + .withProperty("authN.cert-path", CertificateBuilder.INSTANCE_KEY, AbstractCommonIT::getValidClientCert); @BeforeEach public void setup() { @@ -202,10 +202,6 @@ private static String getPrivateKeyPath(String prefix) { return getPemCertificate(prefix).keyPath(); } - private static String getCertificatePath() { - return getPemCertificate(VALID_PEM_PREFIX).certPath(); - } - private static String getPrivateKey(String prefix) { return CertUtils.loadKey(getPrivateKeyPath(prefix)); } @@ -221,4 +217,8 @@ private static PemCertificate getPemCertificate(String certPrefix) { private static CertificateBuilder getCertBuilder() { return app. getPropertyFromContext(CertificateBuilder.INSTANCE_KEY); } + + private static String getValidClientCert(CertificateBuilder cb) { + return ((PemCertificate) cb.findCertificateByPrefix(VALID_PEM_PREFIX)).certPath(); + } }