Skip to content

Commit 7b9659d

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: [Security] Document the delete_cookies option
2 parents f4fc63f + b7c54d9 commit 7b9659d

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

reference/configuration/security.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Configuration
2929

3030
* `access_denied_url`_
3131
* `always_authenticate_before_granting`_
32+
* `delete_cookies`_
3233
* `erase_credentials`_
3334
* `hide_user_not_found`_
3435
* `session_fixation_strategy`_
@@ -66,6 +67,81 @@ If ``true``, the user is asked to authenticate before each call to the
6667
``isGranted()`` method in services and controllers or ``is_granted()`` from
6768
templates.
6869

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

0 commit comments

Comments
 (0)