public function initializeUserSession(WebRequest $request, Response $response, User $user)
    {
        // If the session already has user data ...
        if ($request->getSessionData('userUuid') !== false) {
            $sessionToken = $request->getSessionData('userSessionToken');
            $sessionTokenLifetime = $request->getSessionData('userSessionTokenLifetime');
            
            // Cleanup the session
            $this->cleanupSession($request);
            
            // Save the old session token for some requests in the next 60 seconds
            if ($sessionToken !== false) {
                $request->setSessionData('oldUserSessionToken', $sessionToken);
                $request->setSessionData('oldUserSessionTokenLifetime', $sessionTokenLifetime);
            }
        }
        
        // Regenerate the session
        $this->regenerateSession($request);
        
        $sessionToken = md5($user->getUuid()) . '-' . md5(uniqid());
        $sessionTokenLifeTime = time() + 300;
        
        $request->setSessionData('userUuid', $user->getUuid());
        $request->setSessionData('userSessionToken', $sessionToken);
        $request->setSessionData('userSessionTokenLifetime', $sessionTokenLifeTime);

        setcookie($sessionToken, $sessionTokenLifeTime, 0, '/', '', $request->isSsl());
    }