protected function setAuthenticationCookie(Request $request, Response $response, $token)
    {
        $response->setVary('Cookies', false)->setMaxAge(0)->setPrivate();
        $response->headers->setCookie(
            new Cookie(
                $this->app['token.authentication.name'],
                $token,
                time() + $this->getOption('general/cookies_lifetime'),
                $request->getBasePath(),
                $this->getOption('general/cookies_domain'),
                $this->getOption('general/enforce_ssl'),
                true
            )
        );

        return $response;
    }