Skip to content

[SecurityBundle] Stop delete_cookies keys from being normalized #24018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
->fixXmlConfig('delete_cookie')
->children()
->arrayNode('delete_cookies')
->normalizeKeys(false)
->beforeNormalization()
->ifTrue(function ($v) { return is_array($v) && is_int(key($v)); })
->then(function ($v) { return array_map(function ($v) { return array('name' => $v); }, $v); })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ public function testRememberMeThrowExceptions()
$this->assertFalse($service->getArgument(5));
}

public function testCookieClearingName()
{
$container = $this->getContainer('container1');
$this->assertArrayHasKey('cookie-name', $container->getDefinition('security.logout.handler.cookie_clearing.secure')->getArgument(0));
}

protected function getContainer($file)
{
$file = $file.'.'.$this->getFileExtension();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
'switch_user' => true,
'x509' => true,
'remote_user' => true,
'logout' => true,
'logout' => array(
'delete_cookies' => array('cookie-name' => true),
),
'remember_me' => array('key' => 'TheKey'),
),
'host' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@
<switch-user />
<x509 />
<remote-user />
<logout />
<logout>
<delete-cookies>
<cookie-name/>
</delete-cookies>
</logout>
<remember-me key="TheyKey"/>
</firewall>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ security:
switch_user: true
x509: true
remote_user: true
logout: true
logout:
delete_cookies:
cookie-name: ~
remember_me:
key: TheKey
host:
Expand Down