@@ -40,11 +40,11 @@ and your generated code may be slightly different:
4040 .. versionadded :: 1.8
4141 Support for login form authentication was added to ``make:auth `` in MakerBundle 1.8.
4242
43- This generates three things: ( 1) a login route & controller, ( 2) a template that
44- renders the login form and ( 3) a :doc: `Guard authenticator </security/guard_authentication >`
45- class that processes the login submit.
43+ This generates the following: 1) a login route & controller, 2) a template that
44+ renders the login form, 3) a :doc: `Guard authenticator </security/guard_authentication >`
45+ class that processes the login submit and 4) updates the main security config file .
4646
47- The ``/login `` route & controller::
47+ ** Step 1. ** The ``/login `` route & controller::
4848
4949 // src/Controller/SecurityController.php
5050 namespace App\Controller;
@@ -73,8 +73,8 @@ The ``/login`` route & controller::
7373 }
7474 }
7575
76- The template has very little to do with security: it just generates a traditional
77- HTML form that submits to ``/login ``:
76+ ** Step 2. ** The template has very little to do with security: it just generates
77+ a traditional HTML form that submits to ``/login ``:
7878
7979.. code-block :: twig
8080
@@ -115,7 +115,7 @@ HTML form that submits to ``/login``:
115115 </form>
116116 {% endblock %}
117117
118- The Guard authenticator processes the form submit::
118+ ** Step 3. ** The Guard authenticator processes the form submit::
119119
120120 // src/Security/LoginFormAuthenticator.php
121121 namespace App\Security;
@@ -212,6 +212,63 @@ The Guard authenticator processes the form submit::
212212 }
213213 }
214214
215+ **Step 4. ** Updates the main security config file to enable the Guard authenticator:
216+
217+ .. configuration-block ::
218+
219+ .. code-block :: yaml
220+
221+ # config/packages/security.yaml
222+ security :
223+ # ...
224+
225+ firewalls :
226+ main :
227+ # ...
228+ guard :
229+ authenticators :
230+ - App\Security\LoginFormAuthenticator
231+
232+ .. code-block :: xml
233+
234+ <!-- config/packages/security.xml -->
235+ <?xml version =" 1.0" charset =" UTF-8" ?>
236+ <srv : container xmlns =" http://symfony.com/schema/dic/security"
237+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
238+ xmlns : srv =" http://symfony.com/schema/dic/services"
239+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
240+ http://symfony.com/schema/dic/services/services-1.0.xsd" >
241+
242+ <config >
243+ <!-- ... -->
244+ <firewall name =" main" >
245+ <!-- ... -->
246+ <guard >
247+ <authenticator class =" App\Security\LoginFormAuthenticator" />
248+ </guard >
249+ </firewall >
250+ </config >
251+ </srv : container >
252+
253+ .. code-block :: php
254+
255+ // app/config/security.php
256+ use App\Security\LoginFormAuthenticator;
257+
258+ $container->loadFromExtension('security', [
259+ // ...
260+ 'firewalls' => [
261+ 'main' => [
262+ // ...,
263+ 'guard' => [
264+ 'authenticators' => [
265+ LoginFormAuthenticator::class,
266+ ]
267+ ],
268+ ],
269+ ],
270+ ]);
271+
215272 Finishing the Login Form
216273------------------------
217274
0 commit comments