From e629ea858ba400232afea9b916b0408e99d74d4d Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Sat, 02 Nov 2024 08:47:24 +0000
Subject: [PATCH] Update to Keycloak 26.0.5

---
 src/main/java/org/keycloak/protocol/cas/utils/ContentTypeHelper.java |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/keycloak/protocol/cas/utils/ContentTypeHelper.java b/src/main/java/org/keycloak/protocol/cas/utils/ContentTypeHelper.java
index e842ef0..f74b9f5 100644
--- a/src/main/java/org/keycloak/protocol/cas/utils/ContentTypeHelper.java
+++ b/src/main/java/org/keycloak/protocol/cas/utils/ContentTypeHelper.java
@@ -1,27 +1,27 @@
 package org.keycloak.protocol.cas.utils;
 
-import org.jboss.resteasy.spi.HttpRequest;
+import jakarta.ws.rs.core.*;
 import org.keycloak.protocol.cas.CASLoginProtocol;
-
-import javax.ws.rs.core.*;
+import org.keycloak.protocol.cas.representations.CASErrorCode;
 
 public class ContentTypeHelper {
-    private final HttpRequest request;
-    private final Request restRequest;
     private final UriInfo uriInfo;
 
-    public ContentTypeHelper(HttpRequest request, Request restRequest, UriInfo uriInfo) {
-        this.request = request;
-        this.restRequest = restRequest;
+    public ContentTypeHelper(UriInfo uriInfo) {
         this.uriInfo = uriInfo;
     }
 
     public MediaType selectResponseType() {
         String format = uriInfo.getQueryParameters().getFirst(CASLoginProtocol.FORMAT_PARAM);
         if (format != null && !format.isEmpty()) {
-            request.getMutableHeaders().add(HttpHeaders.ACCEPT, "application/" + format);
+            if (format.equalsIgnoreCase("json")) {
+                return MediaType.APPLICATION_JSON_TYPE;
+            } else if (format.equalsIgnoreCase("xml")) {
+                return MediaType.APPLICATION_XML_TYPE;
+            } else {
+                throw new CASValidationException(CASErrorCode.INVALID_REQUEST, "Unsupported value of parameter " + CASLoginProtocol.FORMAT_PARAM, Response.Status.BAD_REQUEST);
+            }
         }
-        Variant variant = restRequest.selectVariant(Variant.mediaTypes(MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_JSON_TYPE).build());
-        return variant == null ? MediaType.APPLICATION_XML_TYPE : variant.getMediaType();
+        return MediaType.APPLICATION_XML_TYPE;
     }
 }

--
Gitblit v1.9.1