/** * Logs a user out of Drupal, then redirects them to the CAS server logout. */ public function logout() { // Get the CAS server logout Url. $logout_url = $this->casHelper->getServerLogoutUrl($this->requestStack->getCurrentRequest()); // Log the user out. This invokes hook_user_logout and destroys the // session. $this->userLogout(); $this->casHelper->log("Drupal session terminated; redirecting to CAS logout at: {$logout_url}"); // Redirect the user to the CAS logout screen. return new TrustedRedirectResponse($logout_url, 302); }