Skip to content

Commit 91a9223

Browse files
committed
[Security] Document the delete_cookies option
1 parent d28b6c4 commit 91a9223

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

reference/configuration/security.rst

+76
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Configuration
3030
* `access_denied_url`_
3131
* `always_authenticate_before_granting`_
3232
* `anonymous`_
33+
* `delete_cookies`_
3334
* `erase_credentials`_
3435
* `hide_user_not_found`_
3536
* `session_fixation_strategy`_
@@ -75,6 +76,81 @@ call in a template or ``isGranted()`` in a controller or service).
7576

7677
The ``lazy`` value of the ``anonymous`` option was introduced in Symfony 4.4.
7778

79+
delete_cookies
80+
~~~~~~~~~~~~~~
81+
82+
**type**: ``array`` **default**: ``[]``
83+
84+
Lists the names (and other optional features) of the cookies to delete when the
85+
user logs out::
86+
87+
.. configuration-block::
88+
89+
.. code-block:: yaml
90+
91+
# config/packages/security.yaml
92+
security:
93+
# ...
94+
95+
firewalls:
96+
main:
97+
# ...
98+
logout:
99+
delete_cookies:
100+
cookie1-name: null
101+
cookie2-name:
102+
path: '/'
103+
cookie3-name:
104+
path: null
105+
domain: example.com
106+
107+
.. code-block:: xml
108+
109+
<!-- config/packages/security.xml -->
110+
<?xml version="1.0" encoding="UTF-8" ?>
111+
<srv:container xmlns="http://symfony.com/schema/dic/security"
112+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
113+
xmlns:srv="http://symfony.com/schema/dic/services"
114+
xsi:schemaLocation="http://symfony.com/schema/dic/services
115+
https://symfony.com/schema/dic/services/services-1.0.xsd">
116+
117+
<config>
118+
<!-- ... -->
119+
120+
<firewall name="main">
121+
<!-- ... -->
122+
<logout path="...">
123+
<delete-cookie name="cookie1-name"/>
124+
<delete-cookie name="cookie2-name" path="/"/>
125+
<delete-cookie name="cookie3-name" domain="example.com"/>
126+
</logout>
127+
</firewall>
128+
</config>
129+
</srv:container>
130+
131+
.. code-block:: php
132+
133+
// config/packages/security.php
134+
$container->loadFromExtension('security', [
135+
// ...
136+
'firewalls' => [
137+
'main' => [
138+
'logout' => [
139+
'delete_cookies' => [
140+
'cookie1-name' => null,
141+
'cookie2-name' => [
142+
'path' => '/',
143+
],
144+
'cookie3-name' => [
145+
'path' => null,
146+
'domain' => 'example.com',
147+
],
148+
],
149+
],
150+
],
151+
],
152+
]);
153+
78154
erase_credentials
79155
~~~~~~~~~~~~~~~~~
80156

0 commit comments

Comments
 (0)