setDefaultCsrfSecret() публичный статический Метод

Sets the CSRF secret used in all new CSRF protected forms
public static setDefaultCsrfSecret ( string $secret )
$secret string
 /**
  * Boots the Bundle.
  */
 public function boot()
 {
     if ($this->container->has('error_handler')) {
         $this->container->get('error_handler');
     }
     if ($this->container->hasParameter('csrf_secret')) {
         FormConfiguration::setDefaultCsrfSecret($this->container->getParameter('csrf_secret'));
         FormConfiguration::enableDefaultCsrfProtection();
     }
 }
Пример #2
0
 public function testDefaultCsrfSecretCanBeSet()
 {
     FormConfiguration::setDefaultCsrfSecret('foobar');
     $form = new Form('author', new Author(), $this->validator);
     $form->enableCsrfProtection();
     $this->assertEquals('foobar', $form->getCsrfSecret());
 }