8000 [FrameworkBundle] Automatically enable the CSRF protection *and sessi… · symfony/symfony@226a2cc · GitHub
[go: up one dir, main page]

Skip to content

Commit 226a2cc

Browse files
[FrameworkBundle] Automatically enable the CSRF protection *and session* if CSRF manager exists
1 parent 60ddf9e commit 226a2cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\Form\Form;
2222
use Symfony\Component\Lock\Lock;
2323
use Symfony\Component\Lock\Store\SemaphoreStore;
24+
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
2425
use Symfony\Component\Serializer\Serializer;
2526
use Symfony\Component\Translation\Translator;
2627
use Symfony\Component\Validator\Validation;
@@ -142,7 +143,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
142143
$rootNode
143144
->children()
144145
->arrayNode('csrf_protection')
145-
->canBeEnabled()
146+
->{!class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
146147
->end()
147148
->end()
148149
;
@@ -449,7 +450,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
449450
->children()
450451
->arrayNode('session')
451452
->info('session configuration')
452-
->canBeEnabled()
453+
->{!class_exists(FullStack::class) && interface_exists(CsrfTokenManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
453454
->children()
454455
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
455456
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()

0 commit comments

Comments
 (0)
0