Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(security): add firewall lazy option #20459

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
// ...
};

.. _reference-security-lazy:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that used somewhere or mandatory for any reason ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a simple copy/paste from "stateless" doc part for now :s


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);
Comment on lines +1125 to +1126
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$mainFirewall = $security->firewall('main');
$mainFirewall->lazy(true);
$security->firewall('main')
->lazy(true);

What do you think about this syntax ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will cs fix if the PR is accepted and we decide how to document this option :)

// ...
};

User Checkers
~~~~~~~~~~~~~

Expand Down
Loading