Skip to content

Commit d0f81dd

Browse files
authored
feat(Keycloak): Support admin bootstrapping for version 26 onwards (#1400)
1 parent 2c691d2 commit d0f81dd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Testcontainers.Keycloak/KeycloakBuilder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private KeycloakBuilder(KeycloakConfiguration resourceConfiguration)
4444
public KeycloakBuilder WithUsername(string username)
4545
{
4646
return Merge(DockerResourceConfiguration, new KeycloakConfiguration(username: username))
47+
.WithEnvironment("KC_BOOTSTRAP_ADMIN_USERNAME", username)
4748
.WithEnvironment("KEYCLOAK_ADMIN", username);
4849
}
4950

@@ -55,6 +56,7 @@ public KeycloakBuilder WithUsername(string username)
5556
public KeycloakBuilder WithPassword(string password)
5657
{
5758
return Merge(DockerResourceConfiguration, new KeycloakConfiguration(password: password))
59+
.WithEnvironment("KC_BOOTSTRAP_ADMIN_PASSWORD", password)
5860
.WithEnvironment("KEYCLOAK_ADMIN_PASSWORD", password);
5961
}
6062

tests/Testcontainers.Keycloak.Tests/KeycloakContainerTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,13 @@ public KeycloakV25Configuration()
6565
{
6666
}
6767
}
68+
69+
[UsedImplicitly]
70+
public sealed class KeycloakV26Configuration : KeycloakContainerTest
71+
{
72+
public KeycloakV26Configuration()
73+
: base(new KeycloakBuilder().WithImage("quay.io/keycloak/keycloak:26.0").Build())
74+
{
75+
}
76+
}
6877
}

0 commit comments

Comments
 (0)