From 2f9934958370d5d1d1543e304aad060bf764778a Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Fri, 24 Nov 2023 13:37:32 +0000 Subject: [PATCH] Integration tests: print test name before execution --- src/main/java/org/keycloak/protocol/cas/utils/LogoutHelper.java | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/keycloak/protocol/cas/utils/LogoutHelper.java b/src/main/java/org/keycloak/protocol/cas/utils/LogoutHelper.java index ec365cd..a807f02 100644 --- a/src/main/java/org/keycloak/protocol/cas/utils/LogoutHelper.java +++ b/src/main/java/org/keycloak/protocol/cas/utils/LogoutHelper.java @@ -1,20 +1,22 @@ package org.keycloak.protocol.cas.utils; +import jakarta.ws.rs.core.HttpHeaders; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicNameValuePair; import org.keycloak.connections.httpclient.HttpClientProvider; import org.keycloak.models.KeycloakSession; -import javax.ws.rs.core.HttpHeaders; import java.io.IOException; import java.io.InputStream; -import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.LinkedList; +import java.util.List; import java.util.UUID; public class LogoutHelper { @@ -25,12 +27,14 @@ " <samlp:SessionIndex>$SESSION_IDENTIFIER</samlp:SessionIndex>\n" + "</samlp:LogoutRequest>"; - public static HttpEntity buildSingleLogoutRequest(String serviceTicket) { + public static HttpEntity buildSingleLogoutRequest(String serviceTicket) throws IOException { String id = "ID_" + UUID.randomUUID().toString(); String issueInstant = new SimpleDateFormat("yyyy-MM-dd'T'H:mm:ss").format(new Date()); String document = TEMPLATE.replace("$ID", id).replace("$ISSUE_INSTANT", issueInstant) .replace("$SESSION_IDENTIFIER", serviceTicket); - return new StringEntity(document, ContentType.APPLICATION_XML.withCharset(StandardCharsets.UTF_8)); + List<NameValuePair> parameters = new LinkedList<>(); + parameters.add(new BasicNameValuePair("logoutRequest", document)); + return new UrlEncodedFormEntity(parameters); } public static void postWithRedirect(KeycloakSession session, String url, HttpEntity postBody) throws IOException { -- Gitblit v1.9.1