File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -534,6 +534,41 @@ enabled
534534This option can be used to disable CSRF protection on *all * forms. But you
535535can also :ref: `disable CSRF protection on individual forms <form-csrf-customization >`.
536536
537+ .. configuration-block ::
538+
539+ .. code-block :: yaml
540+
541+ # config/packages/framework.yaml
542+ framework :
543+ # ...
544+ csrf_protection : true
545+
546+ .. code-block :: xml
547+
548+ <!-- config/packages/framework.xml -->
549+ <?xml version =" 1.0" encoding =" UTF-8" ?>
550+ <container xmlns =" http://symfony.com/schema/dic/services"
551+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
552+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
553+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
554+ https://symfony.com/schema/dic/services/services-1.0.xsd
555+ http://symfony.com/schema/dic/symfony
556+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
557+ <framework : config >
558+ <framework : csrf-protection enabled =" true" />
559+ </framework : config >
560+ </container >
561+
562+ .. code-block :: php
563+
564+ // config/packages/framework.php
565+ use Symfony\Config\FrameworkConfig;
566+ return static function (FrameworkConfig $framework) {
567+ $framework->csrfProtection()
568+ ->enabled(true)
569+ ;
570+ };
571+
537572 If you're using forms, but want to avoid starting your session (e.g. using
538573forms in an API-only website), ``csrf_protection `` will need to be set to
539574``false ``.
You can’t perform that action at this time.
0 commit comments