Skip to content

Commit c16923d

Browse files
Deveosyswouterj
authored andcommitted
Update form_login_setup.rst
1 parent bd68890 commit c16923d

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

security/form_login_setup.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,50 @@ class that processes the login submit and 4) updates the main security config fi
7373
}
7474
}
7575

76+
Edit the security.yml file in order to allow access to the ``/login`` route:
77+
78+
.. configuration-block::
79+
80+
.. code-block:: yaml
81+
82+
# config/packages/security.yaml
83+
security:
84+
# ...
85+
86+
access_control:
87+
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
88+
# ...
89+
90+
.. code-block:: xml
91+
92+
<!-- config/packages/security.xml -->
93+
<?xml version="1.0" charset="UTF-8" ?>
94+
<srv:container xmlns="http://symfony.com/schema/dic/security"
95+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
96+
xmlns:srv="http://symfony.com/schema/dic/services"
97+
xsi:schemaLocation="http://symfony.com/schema/dic/services
98+
http://symfony.com/schema/dic/services/services-1.0.xsd">
99+
100+
<config>
101+
<rule path="^/login" role="IS_AUTHENTICATED_ANONYMOUSLY" />
102+
<!-- ... -->
103+
</config>
104+
</srv:container>
105+
106+
.. code-block:: php
107+
108+
// config/packages/security.php
109+
$container->loadFromExtension('security', [
110+
// ...
111+
'access_control' => [
112+
[
113+
'path' => '^/login',
114+
'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY',
115+
],
116+
// ...
117+
],
118+
]);
119+
76120
**Step 2.** The template has very little to do with security: it just generates
77121
a traditional HTML form that submits to ``/login``:
78122

0 commit comments

Comments
 (0)