@Override
    public LogoutRedirectionResponse handle(final HttpServletRequest request, final HttpServletResponse response) {
        val logoutResponse = LogoutRedirectionResponse.builder();
        Optional.ofNullable(argumentExtractor.extractService(request))
            .or(() -> {
                val redirectUrl = casProperties.getView().getDefaultRedirectUrl();
                return FunctionUtils.doIf(StringUtils.isNotBlank(redirectUrl),
                    () -> Optional.of(serviceFactory.createService(redirectUrl)),
                    Optional::<WebApplicationService>empty).get();
            })
            .filter(service -> singleLogoutServiceLogoutUrlBuilder.isServiceAuthorized(service, Optional.of(request), Optional.of(response)))
            .filter(service -> {
                val registeredService = servicesManager.findServiceBy(service);
                return registeredService instanceof CasRegisteredService;
            })
            .ifPresentOrElse(service -> {
                logoutResponse.service(Optional.of(service));
                if (casProperties.getLogout().isFollowServiceRedirects()) {
                    LOGGER.debug("Redirecting to logout URL identified by service [{}]", service);
                    logoutResponse.logoutRedirectUrl(Optional.of(service.getOriginalUrl()));
                } else {
                    LOGGER.debug("Cannot redirect to [{}] given the service is unauthorized to use CAS, "
                                 + "or following logout redirects is disabled in CAS settings. "
                                 + "Ensure the service is registered with CAS and is enabled to allow access", service);
                }
            }, () -> {
                val authorizedRedirectUrlFromRequest = WebUtils.getLogoutRedirectUrl(request, String.class);
                if (StringUtils.isNotBlank(authorizedRedirectUrlFromRequest)) {
                    logoutResponse.logoutRedirectUrl(Optional.of(authorizedRedirectUrlFromRequest));
                }
            });
        return logoutResponse.build();
    }
This is {@link DefaultLogoutRedirectionStrategy}.

@author Misagh Moayyed
@since 6.3.0
core/cas-server-core-logout-api/src/main/java/org/apereo/cas/logout/DefaultLogoutRedirectionStrategy.java