Skip to content

Commit

Permalink
Update security.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
94noni authored Dec 10, 2024
1 parent b89995c commit 9eb33c8
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions reference/configuration/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,58 @@ the session must not be used when authenticating users:
// ...
};
.. _reference-security-lazy:

lazy

Check failure on line 1080 in reference/configuration/security.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please ensure title "lazy" and underline length are matching
~~~~~~~~~

Firewalls can configure a ``lazy`` boolean option in order to load the user and start the session only
if the application actually accesses the User object,
(e.g. via a is_granted() call in a template or isGranted() in a controller or service):

.. configuration-block::

.. code-block:: yaml
# config/packages/security.yaml
security:
# ...
firewalls:
main:
# ...
lazy: true
.. code-block:: xml
<!-- config/packages/security.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:srv="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/security
https://symfony.com/schema/dic/security/security-1.0.xsd">
<config>
<firewall name="main" lazy="true">
<!-- ... -->
</firewall>
</config>
</srv:container>
.. code-block:: php
// config/packages/security.php
use Symfony\Config\SecurityConfig;
return static function (SecurityConfig $security): void {
$mainFirewall = $security->firewall('main');
$mainFirewall->lazy(true);
// ...
};
User Checkers
~~~~~~~~~~~~~

Expand Down

0 comments on commit 9eb33c8

Please sign in to comment.