From 2dc9e536af754f94e8a96cc213faba8ff8bca451 Mon Sep 17 00:00:00 2001
From: Matthias Piepkorn <mpiepk@gmail.com>
Date: Sun, 17 Jun 2018 08:53:06 +0000
Subject: [PATCH] update to Keycloak 4.0.0.Final

---
 src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
index b796962..dd08b5b 100644
--- a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
+++ b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
@@ -12,13 +12,11 @@
 import org.keycloak.services.managers.ClientSessionCode;
 import org.keycloak.services.managers.ResourceAdminManager;
 import org.keycloak.sessions.AuthenticationSessionModel;
-import org.keycloak.sessions.CommonClientSessionModel;
 
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.net.URI;
 
 public class CASLoginProtocol implements LoginProtocol {
@@ -93,16 +91,7 @@
         String service = clientSession.getRedirectUri();
         //TODO validate service
 
-        String code;
-        try {
-            // Keycloak >3.4 branch: Method getCode was renamed to getOrGenerateCode, CODE_TO_TOKEN was removed
-            Method getOrGenerateCode = ClientSessionCode.class.getMethod("getOrGenerateCode");
-            code = (String) getOrGenerateCode.invoke(accessCode);
-        } catch (ReflectiveOperationException e) {
-            // Keycloak <=3.3 branch
-            accessCode.setAction(CommonClientSessionModel.Action.CODE_TO_TOKEN.name());
-            code = accessCode.getCode();
-        }
+        String code = accessCode.getOrGenerateCode();
         KeycloakUriBuilder uriBuilder = KeycloakUriBuilder.fromUri(service);
         uriBuilder.queryParam(TICKET_RESPONSE_PARAM, SERVICE_TICKET_PREFIX + code);
 

--
Gitblit v1.9.1