282282
283283 .. code-block :: xml
284284
285- <!-- app/ config/security.xml -->
285+ <!-- config/packages /security.xml -->
286286 <?xml version =" 1.0" encoding =" UTF-8" ?>
287287 <srv : container xmlns =" http://symfony.com/schema/dic/security"
288288 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
@@ -291,19 +291,24 @@ key:
291291 https://symfony.com/schema/dic/services/services-1.0.xsd" >
292292
293293 <config >
294+ <!-- ... -->
294295 <rule path =" ^/_internal/secure"
295296 allow-if =" '127.0.0.1' == request.getClientIp() or is_granted('ROLE_ADMIN')" />
296297 </config >
297298 </srv : container >
298299
299300 .. code-block :: php
300301
301- 'access_control' => [
302- [
303- 'path' => '^/_internal/secure',
304- 'allow_if' => '"127.0.0.1" == request.getClientIp() or is_granted("ROLE_ADMIN")',
302+ // config/packages/security.php
303+ $container->loadFromExtension('security', [
304+ // ...
305+ 'access_control' => [
306+ [
307+ 'path' => '^/_internal/secure',
308+ 'allow_if' => '"127.0.0.1" == request.getClientIp() or is_granted("ROLE_ADMIN")',
309+ ],
305310 ],
306- ],
311+ ]);
307312
308313 In this case, when the user tries to access any URL starting with ``/_internal/secure ``,
309314they will only be granted access if the IP address is ``127.0.0.1 `` or if
@@ -349,16 +354,20 @@ access those URLs via a specific port. This could be useful for example for
349354 xsi : schemaLocation =" http://symfony.com/schema/dic/services
350355 https://symfony.com/schema/dic/services/services-1.0.xsd" >
351356
352- <rule path =" ^/cart/checkout"
353- role =" IS_AUTHENTICATED_ANONYMOUSLY"
354- port =" 8080"
355- />
357+ <config >
358+ <!-- ... -->
359+ <rule path =" ^/cart/checkout"
360+ role =" IS_AUTHENTICATED_ANONYMOUSLY"
361+ port =" 8080"
362+ />
363+ </config >
356364 </srv : container >
357365
358366 .. code-block :: php
359367
360368 // config/packages/security.php
361369 $container->loadFromExtension('security', [
370+ // ...
362371 'access_control' => [
363372 [
364373 'path' => '^/cart/checkout',
@@ -396,16 +405,20 @@ the user will be redirected to ``https``:
396405 xsi : schemaLocation =" http://symfony.com/schema/dic/services
397406 https://symfony.com/schema/dic/services/services-1.0.xsd" >
398407
399- <rule path =" ^/cart/checkout"
400- role =" IS_AUTHENTICATED_ANONYMOUSLY"
401- requires-channel =" https"
402- />
408+ <config >
409+ <!-- ... -->
410+ <rule path =" ^/cart/checkout"
411+ role =" IS_AUTHENTICATED_ANONYMOUSLY"
412+ requires-channel =" https"
413+ />
414+ </config >
403415 </srv : container >
404416
405417 .. code-block :: php
406418
407419 // config/packages/security.php
408420 $container->loadFromExtension('security', [
421+ // ...
409422 'access_control' => [
410423 [
411424 'path' => '^/cart/checkout',
0 commit comments