From dd8c56ac63ac342dec97ec6f39b023ca381abce3 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 17 Nov 2023 11:51:21 +0100 Subject: [PATCH 1/6] Ignore files coming from quarkus-ide-launcher jar (cherry picked from commit 6d853647c015a4a64addbb4dcfdbf3f83bebdb16) --- independent-projects/parent/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/independent-projects/parent/pom.xml b/independent-projects/parent/pom.xml index 8866840ab58d8..1f5b274c0dc24 100644 --- a/independent-projects/parent/pom.xml +++ b/independent-projects/parent/pom.xml @@ -420,6 +420,11 @@ maven.settings + + + META-INF/ide-deps/** + + From cb08f5267536013de0c2a875bf7f31e5edb82e9d Mon Sep 17 00:00:00 2001 From: barreiro Date: Mon, 20 Nov 2023 01:12:39 +0000 Subject: [PATCH 2/6] recognize quarkus.tls.trust-all property by keycloak-admin-client extension (cherry picked from commit 6e414c29dcc77c8f168b233277a7989f78ab8b94) --- .../reactive/KeycloakAdminClientReactiveProcessor.java | 5 +++-- .../reactive/runtime/ResteasyReactiveClientProvider.java | 8 +++++++- .../ResteasyReactiveKeycloakAdminClientRecorder.java | 4 ++-- .../deployment/KeycloakAdminClientProcessor.java | 5 +++-- .../adminclient/ResteasyKeycloakAdminClientRecorder.java | 4 ++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/extensions/keycloak-admin-client-reactive/deployment/src/main/java/io/quarkus/keycloak/admin/client/reactive/KeycloakAdminClientReactiveProcessor.java b/extensions/keycloak-admin-client-reactive/deployment/src/main/java/io/quarkus/keycloak/admin/client/reactive/KeycloakAdminClientReactiveProcessor.java index 0a486c5e024d1..27c8d4a6f95c2 100644 --- a/extensions/keycloak-admin-client-reactive/deployment/src/main/java/io/quarkus/keycloak/admin/client/reactive/KeycloakAdminClientReactiveProcessor.java +++ b/extensions/keycloak-admin-client-reactive/deployment/src/main/java/io/quarkus/keycloak/admin/client/reactive/KeycloakAdminClientReactiveProcessor.java @@ -25,6 +25,7 @@ import io.quarkus.keycloak.admin.client.common.KeycloakAdminClientInjectionEnabled; import io.quarkus.keycloak.admin.client.reactive.runtime.ResteasyReactiveClientProvider; import io.quarkus.keycloak.admin.client.reactive.runtime.ResteasyReactiveKeycloakAdminClientRecorder; +import io.quarkus.runtime.TlsConfig; public class KeycloakAdminClientReactiveProcessor { @@ -53,8 +54,8 @@ public void nativeImage(BuildProducer serviceProviderP @Record(ExecutionTime.STATIC_INIT) @Produce(ServiceStartBuildItem.class) @BuildStep - public void integrate(ResteasyReactiveKeycloakAdminClientRecorder recorder) { - recorder.setClientProvider(); + public void integrate(ResteasyReactiveKeycloakAdminClientRecorder recorder, TlsConfig tlsConfig) { + recorder.setClientProvider(tlsConfig.trustAll); } @Record(ExecutionTime.RUNTIME_INIT) diff --git a/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java b/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java index a8bb66a6d0096..c39ffee71d45a 100644 --- a/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java +++ b/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java @@ -30,9 +30,15 @@ public class ResteasyReactiveClientProvider implements ResteasyClientProvider { private static final List HANDLED_MEDIA_TYPES = List.of(MediaType.APPLICATION_JSON); private static final int PROVIDER_PRIORITY = Priorities.USER + 100; // ensures that it will be used first + private final boolean tlsTrustAll; + + public ResteasyReactiveClientProvider(boolean tlsTrustAll) { + this.tlsTrustAll = tlsTrustAll; + } + @Override public Client newRestEasyClient(Object messageHandler, SSLContext sslContext, boolean disableTrustManager) { - ClientBuilderImpl clientBuilder = new ClientBuilderImpl().trustAll(disableTrustManager); + ClientBuilderImpl clientBuilder = new ClientBuilderImpl().trustAll(tlsTrustAll || disableTrustManager); return registerJacksonProviders(clientBuilder).build(); } diff --git a/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveKeycloakAdminClientRecorder.java b/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveKeycloakAdminClientRecorder.java index 61d7605485442..12458c795592f 100644 --- a/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveKeycloakAdminClientRecorder.java +++ b/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveKeycloakAdminClientRecorder.java @@ -21,8 +21,8 @@ public ResteasyReactiveKeycloakAdminClientRecorder( this.keycloakAdminClientConfigRuntimeValue = keycloakAdminClientConfigRuntimeValue; } - public void setClientProvider() { - Keycloak.setClientProvider(new ResteasyReactiveClientProvider()); + public void setClientProvider(boolean tlsTrustAll) { + Keycloak.setClientProvider(new ResteasyReactiveClientProvider(tlsTrustAll)); } public Supplier createAdminClient() { diff --git a/extensions/keycloak-admin-client/deployment/src/main/java/io/quarkus/keycloak/adminclient/deployment/KeycloakAdminClientProcessor.java b/extensions/keycloak-admin-client/deployment/src/main/java/io/quarkus/keycloak/adminclient/deployment/KeycloakAdminClientProcessor.java index 056b3c1d5bf93..5ac5f6fef3237 100644 --- a/extensions/keycloak-admin-client/deployment/src/main/java/io/quarkus/keycloak/adminclient/deployment/KeycloakAdminClientProcessor.java +++ b/extensions/keycloak-admin-client/deployment/src/main/java/io/quarkus/keycloak/adminclient/deployment/KeycloakAdminClientProcessor.java @@ -25,6 +25,7 @@ import io.quarkus.keycloak.admin.client.common.AutoCloseableDestroyer; import io.quarkus.keycloak.admin.client.common.KeycloakAdminClientInjectionEnabled; import io.quarkus.keycloak.adminclient.ResteasyKeycloakAdminClientRecorder; +import io.quarkus.runtime.TlsConfig; public class KeycloakAdminClientProcessor { @@ -48,8 +49,8 @@ ReflectiveClassBuildItem reflect() { @Record(ExecutionTime.STATIC_INIT) @Produce(ServiceStartBuildItem.class) @BuildStep - public void integrate(ResteasyKeycloakAdminClientRecorder recorder) { - recorder.setClientProvider(); + public void integrate(ResteasyKeycloakAdminClientRecorder recorder, TlsConfig tlsConfig) { + recorder.setClientProvider(tlsConfig.trustAll); } @Record(ExecutionTime.RUNTIME_INIT) diff --git a/extensions/keycloak-admin-client/runtime/src/main/java/io/quarkus/keycloak/adminclient/ResteasyKeycloakAdminClientRecorder.java b/extensions/keycloak-admin-client/runtime/src/main/java/io/quarkus/keycloak/adminclient/ResteasyKeycloakAdminClientRecorder.java index 9dda7e9c3c475..75fb6d2924896 100644 --- a/extensions/keycloak-admin-client/runtime/src/main/java/io/quarkus/keycloak/adminclient/ResteasyKeycloakAdminClientRecorder.java +++ b/extensions/keycloak-admin-client/runtime/src/main/java/io/quarkus/keycloak/adminclient/ResteasyKeycloakAdminClientRecorder.java @@ -58,13 +58,13 @@ public Keycloak get() { }; } - public void setClientProvider() { + public void setClientProvider(boolean tlsTrustAll) { Keycloak.setClientProvider(new ResteasyClientClassicProvider() { @Override public Client newRestEasyClient(Object customJacksonProvider, SSLContext sslContext, boolean disableTrustManager) { // point here is to use default Quarkus providers rather than org.keycloak.admin.client.JacksonProvider // as it doesn't work properly in native mode - return ClientBuilderWrapper.create(sslContext, disableTrustManager).build(); + return ClientBuilderWrapper.create(sslContext, tlsTrustAll || disableTrustManager).build(); } }); } From d8caa3616cdb32ca2a95ec4a42287ad148d38cfa Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 20 Nov 2023 10:48:45 +0100 Subject: [PATCH 3/6] Build cache - Ignore more files for Spotless (cherry picked from commit 2712330280c6870a991f6b724cf4433ae7baaae7) --- independent-projects/parent/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/independent-projects/parent/pom.xml b/independent-projects/parent/pom.xml index 1f5b274c0dc24..4090d40edfd7a 100644 --- a/independent-projects/parent/pom.xml +++ b/independent-projects/parent/pom.xml @@ -559,6 +559,8 @@ .idea/* target/* .cache/* + .factorypath + *.log true From a2d817f78eb25fb53201bac2cc9b812b01e635eb Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 20 Nov 2023 10:49:00 +0100 Subject: [PATCH 4/6] Build cache - Avoid runtimeClasspath being overridden (cherry picked from commit 7824826929ab4bcecbcd55991b27a70988e41c81) --- integration-tests/oidc-client-reactive/pom.xml | 3 +++ integration-tests/rest-client-reactive/pom.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/integration-tests/oidc-client-reactive/pom.xml b/integration-tests/oidc-client-reactive/pom.xml index 5c9c5f1f2e838..5d504c6944136 100644 --- a/integration-tests/oidc-client-reactive/pom.xml +++ b/integration-tests/oidc-client-reactive/pom.xml @@ -156,6 +156,9 @@ + + META-INF/ide-deps/** + application.properties diff --git a/integration-tests/rest-client-reactive/pom.xml b/integration-tests/rest-client-reactive/pom.xml index 05fc6fb2cf4c5..e70e0e07b177d 100644 --- a/integration-tests/rest-client-reactive/pom.xml +++ b/integration-tests/rest-client-reactive/pom.xml @@ -156,6 +156,9 @@ + + META-INF/ide-deps/** + application.properties From ef18b916e560678ede984cbc9d09e9180be50912 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 20 Nov 2023 11:04:46 +0100 Subject: [PATCH 5/6] Build cache - Avoid hardcoded path in generated test file (cherry picked from commit 5727c2dcbd1afc6c0e0a13bd7edcd3cb0085e204) --- .../project-using-test-template-from-extension/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml b/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml index 2750c013fadbf..eef420dac8589 100644 --- a/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml +++ b/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml @@ -46,7 +46,7 @@ io.quarkus integration-test-extension-that-defines-junit-test-extensions ${quarkus.version} - test + test @@ -109,7 +109,7 @@ - ${project.build.directory}/${project.build.finalName}-runner + \${project.build.directory}/\${project.build.finalName}-runner org.jboss.logmanager.LogManager \${maven.home} From 85dcd005e9ae8461f6675f48f36c13154028f11f Mon Sep 17 00:00:00 2001 From: Bernhard Schuhmann Date: Mon, 20 Nov 2023 12:56:02 +0100 Subject: [PATCH 6/6] Use LinkedHashMap for parts map to ensure user input order (cherry picked from commit 6c69e6ddad8ab45bb4f5ec3419d7f1cbdcb41728) --- .../reactive/server/multipart/MultipartFormDataOutput.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java index df175a86839c8..3b8212907a3ca 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java @@ -1,7 +1,7 @@ package org.jboss.resteasy.reactive.server.multipart; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import jakarta.ws.rs.core.MediaType; @@ -10,7 +10,7 @@ * Used when a Resource method needs to return a multipart output */ public final class MultipartFormDataOutput { - private final Map parts = new HashMap<>(); + private final Map parts = new LinkedHashMap<>(); public Map getFormData() { return Collections.unmodifiableMap(parts);