You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/filters.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1880,3 +1880,24 @@ class ValidateParameter {}
1880
1880
```
1881
1881
1882
1882
You can also use your own constraint by setting the `constraints` option on a Parameter. In that case we won't setup the automatic validation for you and it'll replace our defaults.
1883
+
1884
+
1885
+
### Parameter security
1886
+
1887
+
Parameters may have security checks:
1888
+
1889
+
``` php
1890
+
<?php
1891
+
use ApiPlatform\Metadata\GetCollection;
1892
+
use ApiPlatform\Metadata\HeaderParameter;
1893
+
use ApiPlatform\Metadata\QueryParameter;
1894
+
1895
+
#[GetCollection(
1896
+
uriTemplate: 'security_parameters{._format}',
1897
+
parameters: [
1898
+
'sensitive' => new QueryParameter(security: 'is_granted("ROLE_ADMIN")'),
1899
+
'auth' => new HeaderParameter(security: '"secretKey" == auth[0]'),
0 commit comments