Skip to content

Commit 3380018

Browse files
misaertnicolas-grekas
authored andcommitted
[HttpFoundation] Fix clearing CHIPS cookies
1 parent a53a9e1 commit 3380018

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
281281
->scalarNode('domain')->defaultNull()->end()
282282
->scalarNode('secure')->defaultFalse()->end()
283283
->scalarNode('samesite')->defaultNull()->end()
284+
->scalarNode('partitioned')->defaultFalse()->end()
284285
->end()
285286
->end()
286287
->end()

Tests/DependencyInjection/MainConfigurationTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,39 @@ public function testLogoutCsrf()
141141
}
142142
}
143143

144+
public function testLogoutDeleteCookies()
145+
{
146+
$config = [
147+
'firewalls' => [
148+
'stub' => [
149+
'logout' => [
150+
'delete_cookies' => [
151+
'my_cookie' => [
152+
'path' => '/',
153+
'domain' => 'example.org',
154+
'secure' => true,
155+
'samesite' => 'none',
156+
'partitioned' => true,
157+
],
158+
],
159+
],
160+
],
161+
],
162+
];
163+
$config = array_merge(static::$minimalConfig, $config);
164+
165+
$processor = new Processor();
166+
$configuration = new MainConfiguration([], []);
167+
$processedConfig = $processor->processConfiguration($configuration, [$config]);
168+
$this->assertArrayHasKey('delete_cookies', $processedConfig['firewalls']['stub']['logout']);
169+
$deleteCookies = $processedConfig['firewalls']['stub']['logout']['delete_cookies'];
170+
$this->assertSame('/', $deleteCookies['my_cookie']['path']);
171+
$this->assertSame('example.org', $deleteCookies['my_cookie']['domain']);
172+
$this->assertTrue($deleteCookies['my_cookie']['secure']);
173+
$this->assertSame('none', $deleteCookies['my_cookie']['samesite']);
174+
$this->assertTrue($deleteCookies['my_cookie']['partitioned']);
175+
}
176+
144177
public function testDefaultUserCheckers()
145178
{
146179
$processor = new Processor();

0 commit comments

Comments
 (0)