Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1d7e49

Browse files
committed
minor#20811 [Security] Add methods param doc for isCsrfTokenValid attribute (Oviglo)
This PR was squashed before being merged into the 7.3 branch.Discussion----------[Security] Add methods param doc for isCsrfTokenValid attributeAdd new params for isCsrfTokenValid attributePR:symfony/symfony#60007Issue:#20810Commits-------6d7c87f [Security] Add methods param doc for isCsrfTokenValid attribute
2 parents104552b +6d7c87f commita1d7e49

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎security/csrf.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,15 @@ object evaluated to the id::
288288
// ... do something, like deleting an object
289289
}
290290

291+
You can use the ``methods`` parameter to the attribute to specify the HTTP methods that are allowed for
292+
the token validation,:class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` is ignored for other methods. By default, the attribute allows all methods::
293+
294+
#[IsCsrfTokenValid('delete-item', tokenKey: 'token', methods: ['DELETE'])]
295+
public function delete(Post $post): Response
296+
{
297+
// ... delete the object
298+
}
299+
291300
..versionadded::7.1
292301

293302
The:class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp