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

Commit6d7c87f

Browse files
Oviglojaviereguiluz
authored andcommitted
[Security] Add methods param doc for isCsrfTokenValid attribute
1 parenta0758ac commit6d7c87f

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