From ddc7877f4fbefa853a3113287bbc5c81c76d00d5 Mon Sep 17 00:00:00 2001 From: Darran Lofthouse Date: Wed, 26 Jun 2024 15:10:38 +0100 Subject: [PATCH] [ELY-2775] Rename the configuration files as they are specific to the test cases. --- .../wildfly/security/ssl/SSLAuthenticationTest.java | 2 +- .../security/ssl/SSLv2HelloAuthenticationTest.java | 11 ++++++----- .../wildfly/security/ssl/TLS13AuthenticationTest.java | 11 ++++++----- ...-config-v1_7.xml => ssl-authentication-config.xml} | 2 ++ ...v1_6.xml => sslv2-hello-authentication-config.xml} | 2 ++ ...onfig-v1_5.xml => tls13-authentication-config.xml} | 2 ++ 6 files changed, 19 insertions(+), 11 deletions(-) rename tests/base/src/test/resources/org/wildfly/security/ssl/{wildfly-ssl-test-config-v1_7.xml => ssl-authentication-config.xml} (99%) rename tests/base/src/test/resources/org/wildfly/security/ssl/{wildfly-ssl-test-config-v1_6.xml => sslv2-hello-authentication-config.xml} (98%) rename tests/base/src/test/resources/org/wildfly/security/ssl/{wildfly-ssl-test-config-v1_5.xml => tls13-authentication-config.xml} (98%) diff --git a/tests/base/src/test/java/org/wildfly/security/ssl/SSLAuthenticationTest.java b/tests/base/src/test/java/org/wildfly/security/ssl/SSLAuthenticationTest.java index 8666bf529f6..f044a972102 100644 --- a/tests/base/src/test/java/org/wildfly/security/ssl/SSLAuthenticationTest.java +++ b/tests/base/src/test/java/org/wildfly/security/ssl/SSLAuthenticationTest.java @@ -821,7 +821,7 @@ public void testWantClientAuthWithIncorrectCertificate() throws Throwable { } private void performConnectionTest(SSLContext serverContext, String clientUri, boolean expectValid, String expectedServerPrincipal, String expectedClientPrincipal, boolean oneWay) throws Throwable { - System.setProperty("wildfly.config.url", SSLAuthenticationTest.class.getResource("wildfly-ssl-test-config-v1_7.xml").toExternalForm()); + System.setProperty("wildfly.config.url", SSLAuthenticationTest.class.getResource("ssl-authentication-config.xml").toExternalForm()); AccessController.doPrivileged((PrivilegedAction) () -> Security.insertProviderAt(WildFlyElytronPasswordProvider.getInstance(), 1)); AuthenticationContext context = AuthenticationContext.getContextManager().get(); diff --git a/tests/base/src/test/java/org/wildfly/security/ssl/SSLv2HelloAuthenticationTest.java b/tests/base/src/test/java/org/wildfly/security/ssl/SSLv2HelloAuthenticationTest.java index 9e61933f29a..6fb2a57b055 100644 --- a/tests/base/src/test/java/org/wildfly/security/ssl/SSLv2HelloAuthenticationTest.java +++ b/tests/base/src/test/java/org/wildfly/security/ssl/SSLv2HelloAuthenticationTest.java @@ -88,6 +88,7 @@ */ public class SSLv2HelloAuthenticationTest { + private static final String CLIENT_CONFIG = "sslv2-hello-authentication-config.xml"; private static final char[] PASSWORD = "Elytron".toCharArray(); private static final String CA_JKS_LOCATION = "./target/test-classes/ca/jks"; private static File ladybirdFile = null; @@ -170,7 +171,7 @@ public void testOneWaySSLv2HelloProtocolMatch() throws Exception { SecurityIdentity identity = performConnectionTest(serverContext, "protocol://one-way-sslv2hello.org", - "wildfly-ssl-test-config-v1_6.xml", + CLIENT_CONFIG, enabledProtocols, // We expect client and server socket to only have SSLv2Hello and TLSv1 enabled "TLSv1"); // We expect the negotiated protocol to be TLSv1, as SSLv2Hello is a pseudo-protocol } @@ -197,7 +198,7 @@ public void testTwoWaySSLv2HelloProtocolMatch() throws Exception { SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-two-way-sslv2hello.org", - "wildfly-ssl-test-config-v1_6.xml", + CLIENT_CONFIG, enabledProtocols, // We expect client and server socket to only have SSLv2Hello and TLSv1 enabled "TLSv1"); // We expect the negotiated protocol to be TLSv1, as SSLv2Hello is a pseudo-protocol @@ -223,7 +224,7 @@ public void testTwoWaySSLv2HelloNotEnabled() throws Exception { SecurityIdentity identity = performConnectionTest(serverContext, "protocol://two-way-no-sslv2hello.org", - "wildfly-ssl-test-config-v1_6.xml", + CLIENT_CONFIG, enabledProtocols, // We expect the default protocols to be enabled i.e. SSLv2Hello should only be enabled if explicitly configured "TLSv1.2"); // We expect the negotiated protocol to be the highest version protocol in common @@ -254,7 +255,7 @@ public void testTwoWaySSLv2HelloNoClientSupport() throws Exception { SecurityIdentity identity = performConnectionTest(serverContext, "protocol://two-way-no-sslv2hello.org", - "wildfly-ssl-test-config-v1_6.xml", + CLIENT_CONFIG, enabledClientProtocols, enabledServerProtocols, "TLSv1"); // We expect the negotiated protocol to be the highest version protocol in common @@ -284,7 +285,7 @@ public void testTwoWaySSlv2HelloNoServerSupport() throws Exception { SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-two-way-sslv2hello.org", - "wildfly-ssl-test-config-v1_6.xml", + CLIENT_CONFIG, clientEnabledProtocols, serverEnabledProtocols, "NONE"); // handshake is expected to fail, which in turn returns an empty SSLSession diff --git a/tests/base/src/test/java/org/wildfly/security/ssl/TLS13AuthenticationTest.java b/tests/base/src/test/java/org/wildfly/security/ssl/TLS13AuthenticationTest.java index 2b2addb635e..a5475c522f1 100644 --- a/tests/base/src/test/java/org/wildfly/security/ssl/TLS13AuthenticationTest.java +++ b/tests/base/src/test/java/org/wildfly/security/ssl/TLS13AuthenticationTest.java @@ -70,6 +70,7 @@ */ public class TLS13AuthenticationTest { + private static final String CLIENT_CONFIG = "tls13-authentication-config.xml"; private static final char[] PASSWORD = "Elytron".toCharArray(); private static final String CA_JKS_LOCATION = "./target/test-classes/jks"; @@ -113,7 +114,7 @@ public void testTwoWayTLS13() throws Exception { .setNeedClientAuth(true) .build().create(); - SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-two-way-tls13.org", "wildfly-ssl-test-config-v1_5.xml", CIPHER_SUITE, true); + SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-two-way-tls13.org", CLIENT_CONFIG, CIPHER_SUITE, true); assertNotNull(identity); assertEquals("Principal Name", "ladybird", identity.getPrincipal().getName()); } @@ -132,7 +133,7 @@ public void testDifferentPreferredTLS13Suites() throws Exception { .setNeedClientAuth(true) .build().create(); - SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-different-preferred-tls13-suites.org", "wildfly-ssl-test-config-v1_5.xml", REQUIRED_CIPHER_SUITE, true); + SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-different-preferred-tls13-suites.org", CLIENT_CONFIG, REQUIRED_CIPHER_SUITE, true); assertNotNull(identity); assertEquals("Principal Name", "ladybird", identity.getPrincipal().getName()); } @@ -153,7 +154,7 @@ public void testClientTLS12Only() throws Exception { .setNeedClientAuth(true) .build().create(); - SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-client-tls12-only.org", "wildfly-ssl-test-config-v1_5.xml", TLS12_CIPHER_SUITE, false); + SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-client-tls12-only.org", CLIENT_CONFIG, TLS12_CIPHER_SUITE, false); assertNotNull(identity); assertEquals("Principal Name", "ladybird", identity.getPrincipal().getName()); } @@ -170,7 +171,7 @@ public void testServerTLS12Only() throws Exception { .setNeedClientAuth(true) .build().create(); - SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-server-tls12-only.org", "wildfly-ssl-test-config-v1_5.xml", SERVER_CIPHER_SUITE, false); + SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-server-tls12-only.org", CLIENT_CONFIG, SERVER_CIPHER_SUITE, false); assertNotNull(identity); assertEquals("Principal Name", "ladybird", identity.getPrincipal().getName()); } @@ -184,7 +185,7 @@ public void testOneWayTLS13() throws Exception { .setKeyManager(getKeyManager("/jks/scarab.keystore")) .build().create(); - SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-one-way-tls13.org", "wildfly-ssl-test-config-v1_5.xml", CIPHER_SUITE, true); + SecurityIdentity identity = performConnectionTest(serverContext, "protocol://test-one-way-tls13.org", CLIENT_CONFIG, CIPHER_SUITE, true); assertNull(identity); } diff --git a/tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_7.xml b/tests/base/src/test/resources/org/wildfly/security/ssl/ssl-authentication-config.xml similarity index 99% rename from tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_7.xml rename to tests/base/src/test/resources/org/wildfly/security/ssl/ssl-authentication-config.xml index a323343d443..5577e556fe2 100644 --- a/tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_7.xml +++ b/tests/base/src/test/resources/org/wildfly/security/ssl/ssl-authentication-config.xml @@ -17,6 +17,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> + + diff --git a/tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_6.xml b/tests/base/src/test/resources/org/wildfly/security/ssl/sslv2-hello-authentication-config.xml similarity index 98% rename from tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_6.xml rename to tests/base/src/test/resources/org/wildfly/security/ssl/sslv2-hello-authentication-config.xml index 197b3d44798..6269aefcace 100644 --- a/tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_6.xml +++ b/tests/base/src/test/resources/org/wildfly/security/ssl/sslv2-hello-authentication-config.xml @@ -17,6 +17,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> + + diff --git a/tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_5.xml b/tests/base/src/test/resources/org/wildfly/security/ssl/tls13-authentication-config.xml similarity index 98% rename from tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_5.xml rename to tests/base/src/test/resources/org/wildfly/security/ssl/tls13-authentication-config.xml index e23e2fa28ee..84c57691b1c 100644 --- a/tests/base/src/test/resources/org/wildfly/security/ssl/wildfly-ssl-test-config-v1_5.xml +++ b/tests/base/src/test/resources/org/wildfly/security/ssl/tls13-authentication-config.xml @@ -17,6 +17,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> + +