Skip to content

Commit

Permalink
[Security] Do not try to clear CSRF on stateless request
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb33300 committed Aug 25, 2024
1 parent 93e8814 commit 00da582
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ public function __construct(ClearableTokenStorageInterface $csrfTokenStorage)

public function onLogout(LogoutEvent $event): void
{
if ($this->csrfTokenStorage instanceof SessionTokenStorage && !$event->getRequest()->hasPreviousSession()) {
$request = $event->getRequest();

if (
$this->csrfTokenStorage instanceof SessionTokenStorage
&& ($request->attributes->getBoolean('_stateless') || !$request->hasPreviousSession())
) {
return;
}

Expand Down

0 comments on commit 00da582

Please sign in to comment.