@Override
    public List<? extends Serializable> beforeSessionTermination(final RequestContext requestContext) {
        LOGGER.trace("Destroying application session...");
        val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
        val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(requestContext);

        val context = new JEEContext(request, response);
        val manager = new ProfileManager(context, new JEESessionStore());
        manager.removeProfiles();
        val session = request.getSession(false);
        val url = FunctionUtils.doIfNotNull(session, () -> (String) session.getAttribute(Pac4jConstants.REQUESTED_URL));
        return FunctionUtils.doIfNotNull(url, () -> List.of(new Pac4jRequestedUrl(url)), List::<Pac4jRequestedUrl>of).get();
    }
This is {@link DelegatedProfileTerminationHandler}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-pac4j-core/src/main/java/org/apereo/cas/web/flow/logout/DelegatedProfileTerminationHandler.java