Skip to content

Commit 1ab4d04

Browse files
committed
[Security] Add logout configuration for Clear-Site-Data header
1 parent ae1f647 commit 1ab4d04

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

reference/configuration/security.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,72 @@ user logs out::
428428
],
429429
]);
430430
431+
clear_site_data
432+
~~~~~~~~~~~~~~~
433+
434+
**type**: ``array`` **default**: ``[]``
435+
436+
The Clear-Site-Data header clears browsing data (cookies, storage, cache) associated with the requesting website.
437+
It allows web developers to have more control over the data stored by a client browser for their origins.
438+
Allowed values are ``cache``, ``cookies``, ``storage`` and ``executionContexts``.
439+
And it's possible to use ``*`` as a wildcard for all directives::
440+
441+
.. configuration-block::
442+
443+
.. code-block:: yaml
444+
445+
# config/packages/security.yaml
446+
security:
447+
# ...
448+
449+
firewalls:
450+
main:
451+
# ...
452+
logout:
453+
clear_site_data:
454+
- cookies
455+
- storage
456+
457+
.. code-block:: xml
458+
459+
<!-- config/packages/security.xml -->
460+
<?xml version="1.0" encoding="UTF-8" ?>
461+
<srv:container xmlns="http://symfony.com/schema/dic/security"
462+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
463+
xmlns:srv="http://symfony.com/schema/dic/services"
464+
xsi:schemaLocation="http://symfony.com/schema/dic/services
465+
https://symfony.com/schema/dic/services/services-1.0.xsd">
466+
467+
<config>
468+
<!-- ... -->
469+
470+
<firewall name="main">
471+
<!-- ... -->
472+
<logout>
473+
<clear-site-data>cookies</clear-site-data>
474+
<clear-site-data>storage</clear-site-data>
475+
</logout>
476+
</firewall>
477+
</config>
478+
</srv:container>
479+
480+
.. code-block:: php
481+
482+
// config/packages/security.php
483+
$container->loadFromExtension('security', [
484+
// ...
485+
'firewalls' => [
486+
'main' => [
487+
'logout' => [
488+
'clear-site-data' => [
489+
'cookies',
490+
'storage',
491+
],
492+
],
493+
],
494+
],
495+
]);
496+
431497
invalidate_session
432498
~~~~~~~~~~~~~~~~~~
433499

0 commit comments

Comments
 (0)