From 635ded405fe61688f003e3560fb51c70a5f54960 Mon Sep 17 00:00:00 2001
From: Matthias Piepkorn <mpiepk@gmail.com>
Date: Wed, 26 Jul 2017 17:35:32 +0000
Subject: [PATCH] release 1.0.0

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

diff --git a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
index 8198a35..7d82a9a 100644
--- a/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
+++ b/src/main/java/org/keycloak/protocol/cas/CASLoginProtocol.java
@@ -5,6 +5,7 @@
 import org.keycloak.common.util.KeycloakUriBuilder;
 import org.keycloak.events.EventBuilder;
 import org.keycloak.events.EventType;
+import org.keycloak.forms.login.LoginFormsProvider;
 import org.keycloak.models.*;
 import org.keycloak.protocol.LoginProtocol;
 import org.keycloak.protocol.cas.utils.LogoutHelper;
@@ -32,6 +33,8 @@
 
     public static final String SERVICE_TICKET_PREFIX = "ST-";
     public static final String SESSION_SERVICE_TICKET = "service_ticket";
+
+    public static final String LOGOUT_REDIRECT_URI = "CAS_LOGOUT_REDIRECT_URI";
 
     protected KeycloakSession session;
     protected RealmModel realm;
@@ -131,9 +134,17 @@
 
     @Override
     public Response finishLogout(UserSessionModel userSession) {
+        String redirectUri = userSession.getNote(CASLoginProtocol.LOGOUT_REDIRECT_URI);
+
         event.event(EventType.LOGOUT);
         event.user(userSession.getUser()).session(userSession).success();
-        return Response.ok().build();
+        LoginFormsProvider infoPage = session.getProvider(LoginFormsProvider.class).setSuccess("Logout successful");
+        if (redirectUri != null) {
+            infoPage.setAttribute("pageRedirectUri", redirectUri);
+        } else {
+            infoPage.setAttribute("skipLink", true);
+        }
+        return infoPage.createInfoPage();
     }
 
     @Override

--
Gitblit v1.9.1