public function guard()
    {
        if ($this->isHttpMethodFiltered($this->request->getMethod())) {
            $formName = $this->getProvidedFormName();
            $providedToken = $this->getProvidedCsrfToken();
            if (is_null($formName) || is_null($providedToken)) {
                throw new InvalidCsrfException();
            }
            if (!$this->validateToken($formName, $providedToken)) {
                throw new InvalidCsrfException();
            }
        }
    }