Skip to content

Commit fbae0af

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: [Security] Added a missing comment in the firewall config example add comments in firewall configuration of security.rst to make the firewall precedence more explicit
2 parents 37b4d00 + 8e2d950 commit fbae0af

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

security.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,12 @@ will be able to authenticate (e.g. login form, API token, etc).
482482
security:
483483
# ...
484484
firewalls:
485+
# the order in which firewalls are defined is very important, as the
486+
# request will be handled by the first firewall whose pattern matches
485487
dev:
486488
pattern: ^/(_(profiler|wdt)|css|images|js)/
487489
security: false
490+
# a firewall with no pattern should be defined last because it will match all requests
488491
main:
489492
lazy: true
490493
# provider that you set earlier inside providers
@@ -510,10 +513,14 @@ will be able to authenticate (e.g. login form, API token, etc).
510513
511514
<config>
512515
<!-- ... -->
516+
517+
<!-- the order in which firewalls are defined is very important, as the
518+
request will be handled by the first firewall whose pattern matches -->
513519
<firewall name="dev"
514520
pattern="^/(_(profiler|wdt)|css|images|js)/"
515521
security="false"/>
516522
523+
<!-- a firewall with no pattern should be defined last because it will match all requests -->
517524
<firewall name="main"
518525
lazy="true"/>
519526
@@ -532,11 +539,15 @@ will be able to authenticate (e.g. login form, API token, etc).
532539
533540
return static function (SecurityConfig $security): void {
534541
// ...
542+
543+
// the order in which firewalls are defined is very important, as the
544+
// request will be handled by the first firewall whose pattern matches
535545
$security->firewall('dev')
536546
->pattern('^/(_(profiler|wdt)|css|images|js)/')
537547
->security(false)
538548
;
539549
550+
// a firewall with no pattern should be defined last because it will match all requests
540551
$security->firewall('main')
541552
->lazy(true)
542553

0 commit comments

Comments
 (0)