Skip to content

Commit

Permalink
Merge pull request #37226 from gsmet/3.5.3-backports-2
Browse files Browse the repository at this point in the history
3.5.3 backports 2
  • Loading branch information
gsmet authored Nov 21, 2023
2 parents be5b75d + 85dcd00 commit 74caaff
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -53,8 +54,8 @@ public void nativeImage(BuildProducer<ServiceProviderBuildItem> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ public class ResteasyReactiveClientProvider implements ResteasyClientProvider {
private static final List<String> 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Keycloak> createAdminClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
}
Expand Down
7 changes: 7 additions & 0 deletions independent-projects/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@
<ignore>maven.settings</ignore>
</ignoredKeys>
</systemProperties>
<runtimeClassPath>
<ignoredFiles>
<ignoredFile>META-INF/ide-deps/**</ignoredFile>
</ignoredFiles>
</runtimeClassPath>
</normalization>
<plugins>
<plugin>
Expand Down Expand Up @@ -554,6 +559,8 @@
<exclude>.idea/*</exclude>
<exclude>target/*</exclude>
<exclude>.cache/*</exclude>
<exclude>.factorypath</exclude>
<exclude>*.log</exclude>
</excludes>
<normalization>
<ignoreEmptyDirectories>true</ignoreEmptyDirectories>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,7 +10,7 @@
* Used when a Resource method needs to return a multipart output
*/
public final class MultipartFormDataOutput {
private final Map<String, PartItem> parts = new HashMap<>();
private final Map<String, PartItem> parts = new LinkedHashMap<>();

public Map<String, PartItem> getFormData() {
return Collections.unmodifiableMap(parts);
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/oidc-client-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
<gradleEnterprise>
<normalization combine.children="append">
<runtimeClassPath>
<ignoredFiles>
<ignoredFile>META-INF/ide-deps/**</ignoredFile>
</ignoredFiles>
<propertiesNormalizations>
<propertiesNormalization>
<path>application.properties</path>
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/rest-client-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
<gradleEnterprise>
<normalization combine.children="append">
<runtimeClassPath>
<ignoredFiles>
<ignoredFile>META-INF/ide-deps/**</ignoredFile>
</ignoredFiles>
<propertiesNormalizations>
<propertiesNormalization>
<path>application.properties</path>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<groupId>io.quarkus</groupId>
<artifactId>integration-test-extension-that-defines-junit-test-extensions</artifactId>
<version>${quarkus.version}</version>
<scope>test</scope>
<scope>test</scope>
</dependency>

</dependencies>
Expand Down Expand Up @@ -109,7 +109,7 @@
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>\${maven.home}</maven.home>
</systemPropertyVariables>
Expand Down

0 comments on commit 74caaff

Please sign in to comment.