40 StringBuffer buffer =
new StringBuffer();
41 buffer.append(
"<secure-deployment name=\"WAR MODULE NAME.war\">\n");
42 buffer.append(
" <realm>").append(realm.getName()).append(
"</realm>\n");
43 buffer.append(
" <auth-server-url>").append(baseUri.toString()).append(
"</auth-server-url>\n");
44 if (client.isBearerOnly()){
45 buffer.append(
" <bearer-only>true</bearer-only>\n");
47 }
else if (client.isPublicClient()) {
48 buffer.append(
" <public-client>true</public-client>\n");
50 buffer.append(
" <ssl-required>").append(realm.getSslRequired().name()).append(
"</ssl-required>\n");
51 buffer.append(
" <resource>").append(client.getClientId()).append(
"</resource>\n");
53 if (KeycloakOIDCClientInstallation.showVerifyTokenAudience(client)) {
54 buffer.append(
" <verify-token-audience>true</verify-token-audience>\n");
57 String cred = client.getSecret();
58 if (KeycloakOIDCClientInstallation.showClientCredentialsAdapterConfig(client)) {
59 Map<String, Object> adapterConfig = KeycloakOIDCClientInstallation.getClientCredentialsAdapterConfig(session, client);
60 for (Map.Entry<String, Object> entry : adapterConfig.entrySet()) {
61 buffer.append(
" <credential name=\"" + entry.getKey() +
"\">");
63 Object value = entry.getValue();
64 if (value instanceof Map) {
66 Map<String, Object> asMap = (Map<String, Object>) value;
67 for (Map.Entry<String, Object> credEntry : asMap.entrySet()) {
68 buffer.append(
" <" + credEntry.getKey() +
">" + credEntry.getValue().toString() +
"</" + credEntry.getKey() +
">\n");
70 buffer.append(
" </credential>\n");
72 buffer.append(value.toString()).append(
"</credential>\n");
76 if (client.getRoles().size() > 0) {
77 buffer.append(
" <use-resource-role-mappings>true</use-resource-role-mappings>\n");
79 buffer.append(
"</secure-deployment>\n");
80 return Response.ok(buffer.toString(), MediaType.TEXT_PLAIN_TYPE).build();