Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7db4866

Browse files
committed
fixup! Add support for dynamic CSRF id in IsCsrfTokenValid
1 parent d00815a commit 7db4866

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Security/Http/EventListener/IsCsrfTokenValidAttributeListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function onKernelControllerArguments(ControllerArgumentsEvent $event): vo
4444
$arguments = $event->getNamedArguments();
4545

4646
foreach ($attributes as $attribute) {
47-
$id = $this->getIsCsrfTokenValidId($attribute->id, $request, $arguments);
47+
$id = $this->getTokenId($attribute->id, $request, $arguments);
4848

4949
if (!$this->csrfTokenManager->isTokenValid(new CsrfToken($id, $request->request->getString($attribute->tokenKey)))) {
5050
throw new InvalidCsrfTokenException('Invalid CSRF token.');
@@ -57,7 +57,7 @@ public static function getSubscribedEvents(): array
5757
return [KernelEvents::CONTROLLER_ARGUMENTS => ['onKernelControllerArguments', 25]];
5858
}
5959

60-
private function getIsCsrfTokenValidId(string|Expression $id, Request $request, array $arguments): string
60+
private function getTokenId(string|Expression $id, Request $request, array $arguments): string
6161
{
6262
if (!$id instanceof Expression) {
6363
return $id;

0 commit comments

Comments
 (0)