public function logout(Event $event)
    {
        if (phpCAS::isAuthenticated()) {
            //Step 1. When the client clicks logout, this will run.
            //        phpCAS::logout will redirect the client to the CAS server.
            //        The CAS server will, in turn, redirect the client back to
            //        this same logout URL.
            //
            //        phpCAS will stop script execution after it sends the redirect
            //        header, which is a problem because CakePHP still thinks the
            //        user is logged in. See Step 2.
            $auth = $event->subject();
            if ($auth instanceof AuthComponent) {
                $redirectUrl = $auth->config('logoutRedirect');
            }
            if (empty($redirectUrl)) {
                $redirectUrl = '/';
            }
            phpCAS::logout(['url' => Router::url($redirectUrl, true)]);
        }
        //Step 2. We reach this line when the CAS server has redirected the
        //        client back to us. Do nothing in this block; then after this
        //        method returns, CakePHP will do whatever is necessary to log
        //        the user out from its end (destroying the session or whatever).
    }