Skip to content

Commit

Permalink
[issue 105] - Fixing the KeycloakAdminClient so that the realm name i…
Browse files Browse the repository at this point in the history
…s stored and used later
  • Loading branch information
fabiobrz committed Nov 16, 2023
1 parent 13e3ed6 commit 93ede93
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@
*/
public class KeycloakAdminClient {

private Keycloak keycloak;
private final String realmName;
private final Keycloak keycloak;

public KeycloakAdminClient(final String url, final String realm, final String username, final String password)
throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
SSLContext trustAllSSLContext = SSLContextBuilder
.create()
.loadTrustMaterial(TrustAllStrategy.INSTANCE)
.build();

realmName = realm;
keycloak = Keycloak.getInstance(
url,
realm,
Expand All @@ -62,7 +63,6 @@ public KeycloakAdminClient(final String url, final String realm, final String us
*/
public void importRealmConfiguration(InputStream is) throws IOException {
PartialImportRepresentation piRep = JsonSerialization.readValue(is, PartialImportRepresentation.class);
// TODO - fix, the realm name should be passed in as a parameter
keycloak.realm("wildfly-realm").partialImport(piRep);
keycloak.realm(this.realmName).partialImport(piRep);
}
}

0 comments on commit 93ede93

Please sign in to comment.