protected function isTokenValid($app)
{
$csrf = $app['form.csrf_provider'];
$name = Constant::TOKEN_NAME;
if (!$csrf->isTokenValid(new CsrfToken($name, $app['request']->request->get($name)))) {
throw new AccessDeniedHttpException('CSRF token is invalid.');
}
return true;
}