-
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.
- Loading branch information
1 parent
1100b8b
commit d5fc954
Showing
9 changed files
with
246 additions
and
24 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
12 changes: 12 additions & 0 deletions
12
integration-tests/vertx-http/src/main/java/io/quarkus/it/vertx/HelloResource.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,12 @@ | ||
package io.quarkus.it.vertx; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
|
||
@Path("/hello") | ||
public class HelloResource { | ||
@GET | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/ServerWithTLS13Only.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,14 @@ | ||
package io.quarkus.it.vertx; | ||
|
||
import java.util.Map; | ||
|
||
import io.quarkus.test.junit.QuarkusTestProfile; | ||
|
||
public class ServerWithTLS13Only implements QuarkusTestProfile { | ||
|
||
@Override | ||
public Map<String, String> getConfigOverrides() { | ||
return Map.of( | ||
"quarkus.http.ssl.protocols", "TLSv1.3"); | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
...tests/vertx-http/src/test/java/io/quarkus/it/vertx/TlsProtocolVersionDefaultTestCase.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,96 @@ | ||
package io.quarkus.it.vertx; | ||
|
||
import java.util.Set; | ||
import java.util.concurrent.CompletionException; | ||
|
||
import javax.inject.Inject; | ||
import javax.net.ssl.SSLHandshakeException; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.common.http.TestHTTPResource; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.vertx.core.net.JksOptions; | ||
import io.vertx.ext.web.client.WebClientOptions; | ||
import io.vertx.mutiny.core.Vertx; | ||
import io.vertx.mutiny.ext.web.client.WebClient; | ||
|
||
@QuarkusTest | ||
public class TlsProtocolVersionDefaultTestCase { | ||
|
||
@TestHTTPResource(value = "/hello", ssl = true) | ||
String url; | ||
|
||
@Inject | ||
Vertx vertx; | ||
|
||
@Test | ||
void testWithWebClientRequestingMultipleTlsVersions() { | ||
// The Web client is requesting "TLSv1", "TLSv1.1" or "TLSv1.2", the server is exposing TLSv1.3 and TLSv1.2 - all good | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
var resp = client.getAbs(url).sendAndAwait(); | ||
Assertions.assertEquals(200, resp.statusCode()); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls13() { | ||
// The Web client is requesting "TLSv1.3", the server is exposing TLSv1.3 and TLSv1.2 - all good | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.3")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
var resp = client.getAbs(url).sendAndAwait(); | ||
Assertions.assertEquals(200, resp.statusCode()); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls12() { | ||
// The Web client is requesting "TLSv1.2", the server is exposing TLSv1.3 and TLSv1.2 - all good | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.2")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
var resp = client.getAbs(url).sendAndAwait(); | ||
Assertions.assertEquals(200, resp.statusCode()); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls12And13() { | ||
// The Web client is requesting TLS 1.2 or 1.3, the server is exposing TLSv1.3 and TLSv1.2 - all good | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.2", "TLSv1.3")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
var resp = client.getAbs(url).sendAndAwait(); | ||
Assertions.assertEquals(200, resp.statusCode()); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls11() { | ||
// The Web client is requesting "TLSv1.1", the server is exposing TLSv1.3 and TLSv1.2 - KO | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.1")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
Throwable exception = Assertions.assertThrows(CompletionException.class, () -> client.getAbs(url).sendAndAwait()); | ||
Assertions.assertTrue(exception.getCause() instanceof SSLHandshakeException); | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
...sts/vertx-http/src/test/java/io/quarkus/it/vertx/TlsProtocolVersionSelectionTestCase.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,98 @@ | ||
package io.quarkus.it.vertx; | ||
|
||
import java.util.Set; | ||
import java.util.concurrent.CompletionException; | ||
|
||
import javax.inject.Inject; | ||
import javax.net.ssl.SSLHandshakeException; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.common.http.TestHTTPResource; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
import io.vertx.core.net.JksOptions; | ||
import io.vertx.ext.web.client.WebClientOptions; | ||
import io.vertx.mutiny.core.Vertx; | ||
import io.vertx.mutiny.ext.web.client.WebClient; | ||
|
||
@QuarkusTest | ||
@TestProfile(ServerWithTLS13Only.class) | ||
public class TlsProtocolVersionSelectionTestCase { | ||
|
||
@TestHTTPResource(value = "/hello", ssl = true) | ||
String url; | ||
|
||
@Inject | ||
Vertx vertx; | ||
|
||
@Test | ||
void testWithWebClientRequestingMultipleTlsVersions() { | ||
// The Web client is requesting "TLSv1", "TLSv1.1" or "TLSv1.2", the server is exposing 1.3 - KO | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
Throwable exception = Assertions.assertThrows(CompletionException.class, () -> client.getAbs(url).sendAndAwait()); | ||
Assertions.assertTrue(exception.getCause() instanceof SSLHandshakeException); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls13() { | ||
// The Web client is requesting TLS 1.3, the server is exposing 1.3 - all good | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.3")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
var resp = client.getAbs(url).sendAndAwait(); | ||
Assertions.assertEquals(200, resp.statusCode()); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls12And13() { | ||
// The Web client is requesting TLS q.2 or 1.3, the server is exposing 1.3 - all good | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.2", "TLSv1.3")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
var resp = client.getAbs(url).sendAndAwait(); | ||
Assertions.assertEquals(200, resp.statusCode()); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls12() { | ||
// The Web client is requesting TLS 1.2, the server is exposing 1.3 only - KO | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.2")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
Throwable exception = Assertions.assertThrows(CompletionException.class, () -> client.getAbs(url).sendAndAwait()); | ||
Assertions.assertTrue(exception.getCause() instanceof SSLHandshakeException); | ||
} | ||
|
||
@Test | ||
void testWithWebClientRequestingTls11() { | ||
// The Web client is requesting TLS 1.1, the server is exposing 1.3 - KO | ||
WebClient client = WebClient.create(vertx, new WebClientOptions().setSsl(true) | ||
.setEnabledSecureTransportProtocols(Set.of("TLSv1.1")) | ||
.setKeyStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-keystore-1.jks").setPassword("password")) | ||
.setTrustStoreOptions( | ||
new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password")) | ||
.setVerifyHost(false)); | ||
Throwable exception = Assertions.assertThrows(CompletionException.class, () -> client.getAbs(url).sendAndAwait()); | ||
Assertions.assertTrue(exception.getCause() instanceof SSLHandshakeException); | ||
} | ||
} |