@@ -52,6 +52,9 @@ Take the following ``access_control`` entries as an example:
5252 -{ path: '^/admin', roles: ROLE_USER_IP, ips: '%env(TRUSTED_IPS)%' }
5353 -{ path: '^/admin', roles: ROLE_USER_IP, ips: [127.0.0.1, ::1, '%env(TRUSTED_IPS)%'] }
5454
55+ # Request matchers can be used to define access control rules
56+ -{ roles: ROLE_USER, request_matcher: App\Security\RequestMatcher\MyRequestMatcher }
57+
5558 ..code-block ::xml
5659
5760<!-- config/packages/security.xml-->
@@ -82,6 +85,9 @@ Take the following ``access_control`` entries as an example:
8285 <ip >::1</ip >
8386 <ip >%env(TRUSTED_IPS)%</ip >
8487 </rule >
88+
89+ <!-- Request matchers can be used to define access control rules-->
90+ <rule role =" ROLE_USER" request-matcher =" App\Security\RequestMatcher\MyRequestMatcher" />
8591 </config >
8692 </srv : container >
8793
@@ -127,8 +133,18 @@ Take the following ``access_control`` entries as an example:
127133 ->roles(['ROLE_USER_IP'])
128134 ->ips(['127.0.0.1', '::1', '%env(TRUSTED_IPS)%'])
129135 ;
136+
137+ // Request matchers can be used to define access control rules
138+ $security->accessControl()
139+ ->roles(['ROLE_USER'])
140+ ->requestMatcher('App\Security\RequestMatcher\MyRequestMatcher')
141+ ;
130142 };
131143
144+ ..versionadded ::6.1
145+
146+ Support for access control rule definition based on a RequestMatcher was introduced in Symfony 6.1.
147+
132148For each incoming request, Symfony will decide which ``access_control ``
133149to use based on the URI, the client's IP address, the incoming host name,
134150and the request method. Remember, the first rule that matches is used, and