public function generateCsrfToken(WebRequest $request)
    {
        $key = 'csrf-' . $this->generateHash(32);
        $token = $this->generateHash(128);
        
        $request->setSessionData($key, $token);
        
        return array('key' => $key, 'token' => $token);
    }