Skip to content

Commit 5a68bca

Browse files
committed
Add Jaybird 4 support for enableLegacyClientAuth
1 parent f8f3a86 commit 5a68bca

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Version History
77
- Update org.testcontainers:jdbc to 1.14.3
88
- Move static config in modules to constructor (see also https://github.com/testcontainers/testcontainers-java/pull/2473)
99
- Add ContainerState#getHost as a replacement for getContainerIpAddress (see also https://github.com/testcontainers/testcontainers-java/pull/2742)
10-
- Added additional url params in JdbcDatabaseContainer (see also https://github.com/testcontainers/testcontainers-java/issues/1802)
10+
- Added additional url params in JdbcDatabaseContainer (see also https://github.com/testcontainers/testcontainers-java/issues/1802)
11+
- For compatibility with Jaybird 4, when legacy client auth is enabled and `authPlugins` URL param has not been explicitly added, add URL param `authPlugins` with value `Srp256,Srp,Legacy_auth`
1112

1213
1.0.3
1314
-----

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
<testcontainers.version>1.14.3</testcontainers.version>
4141
<lombok.version>1.18.12</lombok.version>
42-
<jaybird.version>3.0.9</jaybird.version>
42+
<jaybird.version>4.0.0.java8</jaybird.version>
4343
</properties>
4444

4545
<dependencies>

src/main/java/org/firebirdsql/testcontainers/FirebirdContainer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class FirebirdContainer<SELF extends FirebirdContainer<SELF>> extends Jdb
1919
public static final Integer FIREBIRD_PORT = 3050;
2020
private static final String FIREBIRD_SYSDBA = "sysdba";
2121
private static final int ARC4_REQUIRED_BITS = 160;
22+
private static final String CONNECTION_PROPERTY_AUTH_PLUGINS = "authPlugins";
2223

2324
private String databaseName = "test";
2425
private String username = "test";
@@ -54,6 +55,10 @@ protected void configure() {
5455

5556
if (enableLegacyClientAuth) {
5657
addEnv("EnableLegacyClientAuth", "true");
58+
if (!urlParameters.containsKey(CONNECTION_PROPERTY_AUTH_PLUGINS)) {
59+
// Allow legacy auth with Jaybird 4, while also allowing Srp256 and Srp
60+
withUrlParam(CONNECTION_PROPERTY_AUTH_PLUGINS, "Srp256,Srp,Legacy_Auth");
61+
}
5762
}
5863

5964
if (enableWireCrypt) {

src/test/java/org/firebirdsql/testcontainers/FirebirdContainerTest.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,33 @@ public void testWithEnableLegacyClientAuth() throws SQLException {
5959
}
6060
}
6161

62+
@Test
63+
public void testWithEnableLegacyClientAuth_jdbcUrlIncludeAuthPlugins_default() {
64+
try (FirebirdContainer<?> container = new FirebirdContainer<>()
65+
.withEnableLegacyClientAuth()) {
66+
container.start();
67+
68+
String jdbcUrl = container.getJdbcUrl();
69+
assertThat(jdbcUrl, allOf(
70+
containsString("?"),
71+
containsString("authPlugins=Srp256,Srp,Legacy_Auth")));
72+
}
73+
}
74+
75+
@Test
76+
public void testWithEnableLegacyClientAuth_jdbcUrlIncludeAuthPlugins_explicitlySet() {
77+
try (FirebirdContainer<?> container = new FirebirdContainer<>()
78+
.withEnableLegacyClientAuth()
79+
.withUrlParam("authPlugins", "Legacy_Auth")) {
80+
container.start();
81+
82+
String jdbcUrl = container.getJdbcUrl();
83+
assertThat(jdbcUrl, allOf(
84+
containsString("?"),
85+
containsString("authPlugins=Legacy_Auth")));
86+
}
87+
}
88+
6289
@Test
6390
public void testWithEnableWireCrypt() throws SQLException {
6491
try (FirebirdContainer<?> container = new FirebirdContainer<>().withEnableWireCrypt()) {
@@ -83,8 +110,8 @@ public void testWithEnableWireCrypt() throws SQLException {
83110
* The 2.5 images of jacobalberty/firebird handle FIREBIRD_DATABASE and need an absolute path to access the database
84111
*/
85112
@Test
86-
public void test258_scImage() throws Exception {
87-
try (FirebirdContainer<?> container = new FirebirdContainer<>(IMAGE + ":2.5.8-sc").withDatabaseName("test")) {
113+
public void test259_scImage() throws Exception {
114+
try (FirebirdContainer<?> container = new FirebirdContainer<>(IMAGE + ":2.5.9-sc").withDatabaseName("test")) {
88115
assertEquals("Expect original database name before start",
89116
"test", container.getDatabaseName());
90117

0 commit comments

Comments
 (0)