@@ -28,7 +28,12 @@ options are used for matching:
2828* ``ip `` or ``ips ``: netmasks are also supported (can be a comma-separated string)
2929* ``port ``: an integer
3030* ``host ``: a regular expression
31- * ``methods ``: one or many methods
31+ * ``methods ``: one or many HTTP methods
32+ * ``request_matcher ``: a service implementing ``RequestMatcherInterface ``
33+
34+ .. versionadded :: 6.1
35+
36+ The ``request_matcher `` option was introduced in Symfony 6.1.
3237
3338Take the following ``access_control `` entries as an example:
3439
@@ -52,7 +57,7 @@ Take the following ``access_control`` entries as an example:
5257 - { path: '^/admin', roles: ROLE_USER_IP, ips: '%env(TRUSTED_IPS)%' }
5358 - { path: '^/admin', roles: ROLE_USER_IP, ips: [127.0.0.1, ::1, '%env(TRUSTED_IPS)%'] }
5459
55- # Request matchers can be used to define access control rules
60+ # for custom matching needs, use a request matcher service
5661 - { roles: ROLE_USER, request_matcher: App\Security\RequestMatcher\MyRequestMatcher }
5762
5863 .. code-block :: xml
@@ -86,7 +91,7 @@ Take the following ``access_control`` entries as an example:
8691 <ip >%env(TRUSTED_IPS)%</ip >
8792 </rule >
8893
89- <!-- Request matchers can be used to define access control rules -->
94+ <!-- for custom matching needs, use a request matcher service -->
9095 <rule role =" ROLE_USER" request-matcher =" App\Security\RequestMatcher\MyRequestMatcher" />
9196 </config >
9297 </srv : container >
@@ -134,17 +139,13 @@ Take the following ``access_control`` entries as an example:
134139 ->ips(['127.0.0.1', '::1', env('TRUSTED_IPS')])
135140 ;
136141
137- // Request matchers can be used to define access control rules
142+ // for custom matching needs, use a request matcher service
138143 $security->accessControl()
139144 ->roles(['ROLE_USER'])
140145 ->requestMatcher('App\Security\RequestMatcher\MyRequestMatcher')
141146 ;
142147 };
143148
144- .. versionadded :: 6.1
145-
146- Support for access control rule definition based on a RequestMatcher was introduced in Symfony 6.1.
147-
148149 For each incoming request, Symfony will decide which ``access_control ``
149150to use based on the URI, the client's IP address, the incoming host name,
150151and the request method. Remember, the first rule that matches is used, and
0 commit comments