-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41297 from gsmet/3.12.0-backports-2
[3.12] 3.12.0 backports 2
- Loading branch information
Showing
50 changed files
with
1,674 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...ment/src/test/java/io/quarkus/rest/client/reactive/tls/MtlsConfigFromRegistryCdiTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package io.quarkus.rest.client.reactive.tls; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.File; | ||
|
||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.core.Context; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.vertx.ext.web.RoutingContext; | ||
import me.escoffier.certs.Format; | ||
import me.escoffier.certs.junit5.Certificate; | ||
import me.escoffier.certs.junit5.Certificates; | ||
|
||
@Certificates(baseDir = "target/certs", certificates = @Certificate(name = "mtls-test", password = "secret", formats = { | ||
Format.JKS, Format.PKCS12, Format.PEM }, client = true)) | ||
public class MtlsConfigFromRegistryCdiTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Client.class, Resource.class) | ||
.addAsResource(new File("target/certs/mtls-test-keystore.p12"), "server-keystore.p12") | ||
.addAsResource(new File("target/certs/mtls-test-server-truststore.p12"), "server-truststore.p12") | ||
.addAsResource(new File("target/certs/mtls-test-client-keystore.p12"), "client-keystore.p12") | ||
.addAsResource(new File("target/certs/mtls-test-client-truststore.p12"), "client-truststore.p12")) | ||
|
||
.overrideConfigKey("quarkus.tls.server.key-store.p12.path", "server-keystore.p12") | ||
.overrideConfigKey("quarkus.tls.server.key-store.p12.password", "secret") | ||
.overrideConfigKey("quarkus.tls.server.trust-store.p12.path", "server-truststore.p12") | ||
.overrideConfigKey("quarkus.tls.server.trust-store.p12.password", "secret") | ||
.overrideConfigKey("quarkus.http.tls-configuration-name", "server") | ||
|
||
.overrideConfigKey("quarkus.tls.rest-client.key-store.p12.path", "client-keystore.p12") | ||
.overrideConfigKey("quarkus.tls.rest-client.key-store.p12.password", "secret") | ||
.overrideConfigKey("quarkus.tls.rest-client.trust-store.p12.path", "client-truststore.p12") | ||
.overrideConfigKey("quarkus.tls.rest-client.trust-store.p12.password", "secret") | ||
.overrideConfigKey("quarkus.rest-client.rc.url", "https://localhost:${quarkus.http.test-ssl-port:8444}") | ||
.overrideConfigKey("quarkus.rest-client.rc.tls-configuration-name", "rest-client"); | ||
|
||
@RestClient | ||
Client client; | ||
|
||
@Test | ||
void shouldHello() { | ||
assertThat(client.echo("w0rld")).isEqualTo("hello, w0rld"); | ||
} | ||
|
||
@Path("/hello") | ||
@RegisterRestClient(configKey = "rc") | ||
public interface Client { | ||
@POST | ||
String echo(String name); | ||
} | ||
|
||
@Path("/hello") | ||
public static class Resource { | ||
@POST | ||
public String echo(String name, @Context RoutingContext rc) { | ||
Assertions.assertThat(rc.request().connection().isSsl()).isTrue(); | ||
Assertions.assertThat(rc.request().isSSL()).isTrue(); | ||
Assertions.assertThat(rc.request().connection().sslSession()).isNotNull(); | ||
return "hello, " + name; | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...ent/src/test/java/io/quarkus/rest/client/reactive/tls/TlsConfigFromPropertiesCdiTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.quarkus.rest.client.reactive.tls; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.File; | ||
|
||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.core.Context; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.vertx.ext.web.RoutingContext; | ||
import me.escoffier.certs.Format; | ||
import me.escoffier.certs.junit5.Certificate; | ||
import me.escoffier.certs.junit5.Certificates; | ||
|
||
@Certificates(baseDir = "target/certs", certificates = @Certificate(name = "tls-test", password = "secret", formats = { | ||
Format.JKS, Format.PKCS12, Format.PEM })) | ||
public class TlsConfigFromPropertiesCdiTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Client.class, Resource.class) | ||
.addAsResource(new File("target/certs/tls-test-keystore.jks"), "keystore.jks") | ||
.addAsResource(new File("target/certs/tls-test-truststore.jks"), "truststore.jks")) | ||
.overrideConfigKey("quarkus.tls.key-store.jks.path", "keystore.jks") | ||
.overrideConfigKey("quarkus.tls.key-store.jks.password", "secret") | ||
|
||
.overrideConfigKey("quarkus.rest-client.rc.url", "https://localhost:${quarkus.http.test-ssl-port:8444}") | ||
.overrideConfigKey("quarkus.rest-client.rc.trust-store", "classpath:truststore.jks") | ||
.overrideConfigKey("quarkus.rest-client.rc.trust-store-password", "secret"); | ||
|
||
@RestClient | ||
Client client; | ||
|
||
@Test | ||
void shouldHello() { | ||
assertThat(client.echo("w0rld")).isEqualTo("hello, w0rld"); | ||
} | ||
|
||
@Path("/hello") | ||
@RegisterRestClient(configKey = "rc") | ||
public interface Client { | ||
@POST | ||
String echo(String name); | ||
} | ||
|
||
@Path("/hello") | ||
public static class Resource { | ||
@POST | ||
public String echo(String name, @Context RoutingContext rc) { | ||
Assertions.assertThat(rc.request().connection().isSsl()).isTrue(); | ||
Assertions.assertThat(rc.request().isSSL()).isTrue(); | ||
Assertions.assertThat(rc.request().connection().sslSession()).isNotNull(); | ||
return "hello, " + name; | ||
} | ||
} | ||
} |
Oops, something went wrong.