Skip to content

Commit a2b3feb

Browse files
committed
[SecurityBundle] Add doc for stateless firewall
1 parent db74d6d commit a2b3feb

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

reference/configuration/security.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,54 @@ multiple firewalls, the "context" could actually be shared:
900900
ignored and you won't be able to authenticate on multiple firewalls at the
901901
same time.
902902

903+
stateless
904+
~~~~~~~~~
905+
906+
Firewalls can configure a ``stateless`` boolean option in order to declare that the session mustn't be used when authenticating user:
907+
908+
.. configuration-block::
909+
910+
.. code-block:: yaml
911+
912+
# config/packages/security.yaml
913+
security:
914+
# ...
915+
916+
firewalls:
917+
main:
918+
# ...
919+
stateless: true
920+
921+
.. code-block:: xml
922+
923+
<!-- config/packages/security.xml -->
924+
<?xml version="1.0" encoding="UTF-8" ?>
925+
<srv:container xmlns="http://symfony.com/schema/dic/security"
926+
xmlns:srv="http://symfony.com/schema/dic/services"
927+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
928+
xsi:schemaLocation="http://symfony.com/schema/dic/services
929+
https://symfony.com/schema/dic/services/services-1.0.xsd
930+
http://symfony.com/schema/dic/security
931+
https://symfony.com/schema/dic/security/security-1.0.xsd">
932+
933+
<config>
934+
<firewall name="main" stateless="true">
935+
<!-- ... -->
936+
</firewall>
937+
</config>
938+
</srv:container>
939+
940+
.. code-block:: php
941+
942+
// config/packages/security.php
943+
use Symfony\Config\SecurityConfig;
944+
945+
return static function (SecurityConfig $security) {
946+
$mainFirewall = $security->firewall('main');
947+
$mainFirewall->stateless(true);
948+
// ...
949+
};
950+
903951
User Checkers
904952
~~~~~~~~~~~~~
905953

0 commit comments

Comments
 (0)