Skip to content

Commit

Permalink
Merge pull request #2164 from darranl/ELY-2775
Browse files Browse the repository at this point in the history
[ELY-2775] Rename the configuration files as they are specific to the test cases.
  • Loading branch information
fjuma authored Jul 9, 2024
2 parents dd978af + 1494b94 commit 0c24b3f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,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<Integer>) () -> Security.insertProviderAt(WildFlyElytronPasswordProvider.getInstance(), 1));

AuthenticationContext context = AuthenticationContext.getContextManager().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/pkcs12";
private static File ladybirdFile = null;
Expand Down Expand Up @@ -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
}
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
*/
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/pkcs12";

private static CAGenerationTool caGenerationTool = null;
Expand Down Expand Up @@ -108,7 +110,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());
}
Expand All @@ -130,7 +132,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());
}
Expand All @@ -154,7 +156,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());
}
Expand All @@ -174,7 +176,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());
}
Expand All @@ -190,7 +192,7 @@ public void testOneWayTLS13() throws Exception {
.setKeyManager(scarab.createKeyManager())
.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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!-- Configuration for the SSLAuthenticationTest -->
<configuration>
<authentication-client xmlns="urn:elytron:client:1.7">
<key-stores>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!-- Configuration for the SSLv2HelloAuthenticationTest-->
<configuration>
<authentication-client xmlns="urn:elytron:client:1.6">
<key-stores>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!-- Configuration for the TLS13AuthenticationTest-->
<configuration>
<authentication-client xmlns="urn:elytron:client:1.5">
<key-stores>
Expand Down

0 comments on commit 0c24b3f

Please sign in to comment.