From e065070751a4e5f96d480327147d64b96cf1b310 Mon Sep 17 00:00:00 2001 From: Stefan Guilhen Date: Wed, 18 Sep 2024 10:49:52 -0300 Subject: [PATCH] Set realm when importing users via keycloak-add-user.json Closes #33060 Signed-off-by: Stefan Guilhen --- .../org/keycloak/services/resources/KeycloakApplication.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java index d2b7f985df..46712533c9 100644 --- a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java +++ b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java @@ -261,6 +261,7 @@ public abstract class KeycloakApplication extends Application { if (realm == null) { ServicesLogger.LOGGER.addUserFailedRealmNotFound(userRep.getUsername(), realmRep.getRealm()); } + session.getContext().setRealm(realm); UserProvider users = session.users();