Source:
<code>public KeycloakConfiguration(final PlatformConfiguration platformConfiguration) { Assert.requireNonNull(platformConfiguration, "platformConfiguration"); this.realmNames = platformConfiguration.getListProperty(REALM_PROPERTY_NAME, Collections.emptyList()); <START> if (this.realmNames.size() > 0) { <END> this.realmName = this.realmNames.get(0); } else { this.realmName = null; } this.applicationName = platformConfiguration.getProperty(APPLICATION_PROPERTY_NAME, APPLICATION_PROPERTY_DEFAULT_VALUE); this.authEndpoint = platformConfiguration.getProperty(AUTH_ENDPOINT_PROPERTY_NAME, AUTH_ENDPOINT_PROPERTY_DEFAULT_VALUE) + "/auth"; this.secureEndpoints.addAll(platformConfiguration.getListProperty(SECURE_ENDPOINTS_PROPERTY_NAME, Collections.emptyList())); this.securityActive = platformConfiguration.getBooleanProperty(SECURITY_ACTIVE_PROPERTY_NAME, false); this.loginEndpointActive = platformConfiguration.getBooleanProperty(LOGIN_ENDPOINTS_ACTIVE_PROPERTY_NAME, true); this.loginEndpoint = platformConfiguration.getProperty(LOGIN_ENDPOINTS_PROPERTY_NAME, LOGIN_ENDPOINTS_PROPERTY_DEFAULT_VALUE); this.cors = platformConfiguration.getBooleanProperty(CORS_PROPERTY_NAME, true); }</code><technical_language>This is wrong. this: In server properties configure 2 properties: security.keycloak.realm defines keycloak realm this server connect security.keycloak.realms defines a list of lists of realms this server use. In this case realm client. ## Why? support 2 security scenarios: - Scenario 1: client sends user & pwd server sends this realm & app in keycloak. In this case keycloak realm & app defined server. - Szenario 2: client sends user, pwd, realm app server. need client keycloak realms server holds a list of supported realms. This is useful if want service / app for customers Based behaviour this: realmNames contains names defined security.keycloak.realms property (if any) name is defined security.keycloak.realm (if defined)</technical_language>

Target:
public KeycloakConfiguration(final PlatformConfiguration platformConfiguration) { Assert.requireNonNull(platformConfiguration, "platformConfiguration"); this.realmName = platformConfiguration.getProperty(REALM_PROPERTY_NAME); final List<String> realmNames = new ArrayList<>(platformConfiguration.getListProperty(REALMS_PROPERTY_NAME, Collections.emptyList())); if (this.realmName != null && !this.realmName.isEmpty() && !realmNames.contains(this.realmName)) { realmNames.add(this.realmName); } this.realmNames = Collections.unmodifiableList(realmNames); this.applicationName = platformConfiguration.getProperty(APPLICATION_PROPERTY_NAME, APPLICATION_PROPERTY_DEFAULT_VALUE); this.authEndpoint = platformConfiguration.getProperty(AUTH_ENDPOINT_PROPERTY_NAME, AUTH_ENDPOINT_PROPERTY_DEFAULT_VALUE) + "/auth"; this.secureEndpoints.addAll(platformConfiguration.getListProperty(SECURE_ENDPOINTS_PROPERTY_NAME, Collections.emptyList())); this.securityActive = platformConfiguration.getBooleanProperty(SECURITY_ACTIVE_PROPERTY_NAME, false); this.loginEndpointActive = platformConfiguration.getBooleanProperty(LOGIN_ENDPOINTS_ACTIVE_PROPERTY_NAME, true); this.loginEndpoint = platformConfiguration.getProperty(LOGIN_ENDPOINTS_PROPERTY_NAME, LOGIN_ENDPOINTS_PROPERTY_DEFAULT_VALUE); this.cors = platformConfiguration.getBooleanProperty(CORS_PROPERTY_NAME, CORS_PROPERTY_DEFAULT_VALUE); }