use of org.keycloak.exportimport.Strategy in project keycloak by keycloak.
the class ImportUtils method importRealms.
public static void importRealms(KeycloakSession session, Collection<RealmRepresentation> realms, Strategy strategy) {
boolean masterImported = false;
// Import admin realm first
for (RealmRepresentation realm : realms) {
if (Config.getAdminRealm().equals(realm.getRealm())) {
if (importRealm(session, realm, strategy, false)) {
masterImported = true;
}
}
}
for (RealmRepresentation realm : realms) {
if (!Config.getAdminRealm().equals(realm.getRealm())) {
importRealm(session, realm, strategy, false);
}
}
// If master was imported, we may need to re-create realm management clients
if (masterImported) {
session.realms().getRealmsStream().filter(realm -> realm.getMasterAdminClient() == null).forEach(realm -> {
logger.infof("Re-created management client in master realm for realm '%s'", realm.getName());
new RealmManager(session).setupMasterAdminManagement(realm);
});
}
}
Aggregations