From de7d254562ee04401894b82e3ee18f46d79ea357 Mon Sep 17 00:00:00 2001
From: Matthias Piepkorn <mpiepk@gmail.com>
Date: Tue, 14 Feb 2017 10:32:07 +0000
Subject: [PATCH] Do not fail on invalid Accept header

---
 src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java b/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
index aff46db..57b0da0 100644
--- a/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
+++ b/src/main/java/org/keycloak/protocol/cas/endpoints/AuthorizationEndpoint.java
@@ -35,8 +35,8 @@
     public Response build() {
         MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
         String service = params.getFirst(CASLoginProtocol.SERVICE_PARAM);
-        boolean renew = "true".equalsIgnoreCase(params.getFirst(CASLoginProtocol.RENEW_PARAM));
-        boolean gateway = "true".equalsIgnoreCase(params.getFirst(CASLoginProtocol.GATEWAY_PARAM));
+        boolean renew = params.containsKey(CASLoginProtocol.RENEW_PARAM);
+        boolean gateway = params.containsKey(CASLoginProtocol.GATEWAY_PARAM);
 
         checkSsl();
         checkRealm();
@@ -46,8 +46,12 @@
         // So back button doesn't work
         CacheControlUtil.noBackButtonCacheControlHeader();
 
+        if (renew) {
+            clientSession.setNote(CASLoginProtocol.RENEW_PARAM, "true");
+        }
+
         this.event.event(EventType.LOGIN);
-        return handleBrowserAuthenticationRequest(clientSession, new CASLoginProtocol(session, realm, uriInfo, headers, event, renew), gateway, false);
+        return handleBrowserAuthenticationRequest(clientSession, new CASLoginProtocol(session, realm, uriInfo, headers, event), gateway, false);
     }
 
     private void checkSsl() {

--
Gitblit v1.9.1