Hi, the issue I encountered is that I wanted to differentiate the redirect URL after login and after logout. When I add the property cas.view.default-redirect-url=${cas.server.name}/home in application.properties, the redirection applies both after login and after logout, which is not desired.
So I implemented this script to intercept the logout without a service, remove the default redirect URL, and continue to /cas/logout.
==========================script================================
Object run(Object... args) {
def context = args[0]
def logger = args[1]
def httpRequest = WebUtils.getHttpServletRequestFromExternalWebflowContext(context)
def service = httpRequest.getParameter("service")
def flowScope = context.flowScope
logger.info("Custom logout interceptor. Incoming service = ${service}")
/* Debug complet
flowScope.asMap().each { k, v ->
logger.info("FLOW SCOPE >> ${k} = ${v}")
}*/
if (!service) {
logger.info("No service provided. Forcing redirect removal.")
// Supprimer l'URL de redirection
if (flowScope.contains("logoutRedirectUrl")) {
flowScope.remove("logoutRedirectUrl")
}
}
return new Event(this, "success")
}
=====================application.properties=======================
--
- Website: https://apereo.github.io/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/ccbfe724-5e3d-4a7f-bbc9-2ce2ea621021n%40apereo.org.