From bba8bfec21d26bc06fe25a3b2ecb827b80fc0fb1 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 28 Jun 2023 10:55:12 +0000
Subject: [PATCH] GitHub Actions: add "contents: write" permission for update-deps job

---
 src/test/java/org/keycloak/protocol/cas/LogoutHelperTest.java |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/test/java/org/keycloak/protocol/cas/LogoutHelperTest.java b/src/test/java/org/keycloak/protocol/cas/LogoutHelperTest.java
index 76169df..b8b6a40 100644
--- a/src/test/java/org/keycloak/protocol/cas/LogoutHelperTest.java
+++ b/src/test/java/org/keycloak/protocol/cas/LogoutHelperTest.java
@@ -1,12 +1,17 @@
 package org.keycloak.protocol.cas;
 
 import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.utils.URLEncodedUtils;
 import org.junit.Test;
 import org.keycloak.protocol.cas.utils.LogoutHelper;
 import org.keycloak.saml.common.constants.JBossSAMLURIConstants;
 import org.keycloak.saml.common.util.DocumentUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
+
+import java.util.List;
+import java.util.stream.Collectors;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -15,7 +20,12 @@
     @Test
     public void testLogoutRequest() throws Exception {
         HttpEntity requestEntity = LogoutHelper.buildSingleLogoutRequest("ST-test");
-        Document doc = DocumentUtil.getDocument(requestEntity.getContent());
+
+        List<NameValuePair> parameters = URLEncodedUtils.parse(requestEntity).stream().filter(parameter -> "logoutRequest".equals(parameter.getName())).collect(Collectors.toList());
+        assertEquals(1, parameters.size());
+
+        String logoutRequest = parameters.get(0).getValue();
+        Document doc = DocumentUtil.getDocument(logoutRequest);
 
         assertEquals("LogoutRequest", doc.getDocumentElement().getLocalName());
         assertEquals(JBossSAMLURIConstants.PROTOCOL_NSURI.get(), doc.getDocumentElement().getNamespaceURI());

--
Gitblit v1.9.1