Skip to content

Commit 7a7a82f

Browse files
committed
[SecurityBundle] Add doc for stateless firewall
1 parent a6246a7 commit 7a7a82f

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
@@ -899,6 +899,54 @@ multiple firewalls, the "context" could actually be shared:
899899
ignored and you won't be able to authenticate on multiple firewalls at the
900900
same time.
901901

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

0 commit comments

Comments
 (0)