@@ -291,19 +291,24 @@ key:
291
291
https://symfony.com/schema/dic/services/services-1.0.xsd" >
292
292
293
293
<config >
294
+ <!-- ... -->
294
295
<rule path =" ^/_internal/secure"
295
296
allow-if =" '127.0.0.1' == request.getClientIp() or is_granted('ROLE_ADMIN')" />
296
297
</config >
297
298
</srv : container >
298
299
299
300
.. code-block :: php
300
301
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
+ ],
305
310
],
306
- ],
311
+ ]);
307
312
308
313
In this case, when the user tries to access any URL starting with ``/_internal/secure ``,
309
314
they 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
349
354
xsi : schemaLocation =" http://symfony.com/schema/dic/services
350
355
https://symfony.com/schema/dic/services/services-1.0.xsd" >
351
356
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 >
356
364
</srv : container >
357
365
358
366
.. code-block :: php
359
367
360
368
// config/packages/security.php
361
369
$container->loadFromExtension('security', [
370
+ // ...
362
371
'access_control' => [
363
372
[
364
373
'path' => '^/cart/checkout',
@@ -396,16 +405,20 @@ the user will be redirected to ``https``:
396
405
xsi : schemaLocation =" http://symfony.com/schema/dic/services
397
406
https://symfony.com/schema/dic/services/services-1.0.xsd" >
398
407
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 >
403
415
</srv : container >
404
416
405
417
.. code-block :: php
406
418
407
419
// config/packages/security.php
408
420
$container->loadFromExtension('security', [
421
+ // ...
409
422
'access_control' => [
410
423
[
411
424
'path' => '^/cart/checkout',
0 commit comments