Source:
<code>public Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI baseUri) { String deploymentName = "WAR MODULE NAME.war"; StringBuilder builder = new StringBuilder(); builder <START> .append("/subsystem=keycloak/secure-deployment=").append(deploymentName).append("/:add( \\\n") <END> .append(" realm=").append(realm.getName()).append(", \\\n") .append(" resource=").append(client.getClientId()).append(", \\\n") .append(" auth-server-url=").append(baseUri).append(", \\\n"); if (client.isBearerOnly()){ builder.append(" bearer-only=true, \\\n"); } else if (client.isPublicClient()) { builder.append(" public-client=true, \\\n"); } if (KeycloakOIDCClientInstallation.showVerifyTokenAudience(client)) { builder.append(" verify-token-audience=true, \\\n"); } if (client.getRoles().size() > 0) { builder.append(" use-resource-role-mappings=true, \\\n"); } builder.append(" ssl-required=").append(realm.getSslRequired().name()).append(")\n\n"); if (KeycloakOIDCClientInstallation.showClientCredentialsAdapterConfig(client)) { Map<String, Object> adapterConfig = KeycloakOIDCClientInstallation.getClientCredentialsAdapterConfig(session, client); for (Map.Entry<String, Object> entry : adapterConfig.entrySet()) { builder.append("/subsystem=keycloak/secure-deployment=").append(deploymentName).append("/") .append("credential=").append(entry.getKey()).append(":add(value=").append(entry.getValue()) .append(")\n"); } } return Response.ok(builder.toString(), MediaType.TEXT_PLAIN_TYPE).build(); }</code><technical_language>deploymentName quotes it, spaces lost "WARMODULENAME.war" in standalone.xml</technical_language>

Target:
public Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI baseUri) { String deploymentName = "WAR MODULE NAME.war"; StringBuilder builder = new StringBuilder(); builder .append("/subsystem=keycloak/secure-deployment=").append(quote(deploymentName)).append("/:add( \\\n") .append(" realm=").append(quote(realm.getName())).append(", \\\n") .append(" resource=").append(quote(client.getClientId())).append(", \\\n") .append(" auth-server-url=").append(baseUri).append(", \\\n"); if (client.isBearerOnly()){ builder.append(" bearer-only=true, \\\n"); } else if (client.isPublicClient()) { builder.append(" public-client=true, \\\n"); } if (KeycloakOIDCClientInstallation.showVerifyTokenAudience(client)) { builder.append(" verify-token-audience=true, \\\n"); } if (client.getRoles().size() > 0) { builder.append(" use-resource-role-mappings=true, \\\n"); } builder.append(" ssl-required=").append(realm.getSslRequired().name()).append(")\n\n"); if (KeycloakOIDCClientInstallation.showClientCredentialsAdapterConfig(client)) { Map<String, Object> adapterConfig = KeycloakOIDCClientInstallation.getClientCredentialsAdapterConfig(session, client); for (Map.Entry<String, Object> entry : adapterConfig.entrySet()) { builder.append("/subsystem=keycloak/secure-deployment=").append(quote(deploymentName)).append("/") .append("credential=").append(entry.getKey()).append(":add(value=").append(entry.getValue()) .append(")\n"); } } return Response.ok(builder.toString(), MediaType.TEXT_PLAIN_TYPE).build(); }