From cbb2f2f81452a97fddbdcc1f6010fbc85682e3b3 Mon Sep 17 00:00:00 2001
From: Erlend Hamnaberg <erlend@hamnaberg.net>
Date: Thu, 29 Nov 2018 07:42:20 +0000
Subject: [PATCH] Redirect to application after login is complete

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

diff --git a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
index a1afb9d..2723079 100644
--- a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
+++ b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
@@ -141,13 +141,14 @@
 
         event.event(EventType.LOGOUT);
         event.user(userSession.getUser()).session(userSession).success();
-        LoginFormsProvider infoPage = session.getProvider(LoginFormsProvider.class).setSuccess("Logout successful");
+
         if (redirectUri != null) {
-            infoPage.setAttribute("pageRedirectUri", redirectUri);
+            return Response.status(302).location(URI.create(redirectUri)).build();
         } else {
+            LoginFormsProvider infoPage = session.getProvider(LoginFormsProvider.class).setSuccess("Logout successful");
             infoPage.setAttribute("skipLink", true);
+            return infoPage.createInfoPage();
         }
-        return infoPage.createInfoPage();
     }
 
     @Override

--
Gitblit v1.9.1