Skip to content

Since symfony/security-csrf 5.3: Using SessionTokenStorage without a session has no effect and is deprecated #46961

Answered by arderyp
arderyp asked this question in Q&A
Discussion options

You must be logged in to vote

I've figured it out. Right now, the solution requires replicating and enhancing the loginUser() function on KernelBrowser. I will submit a PR to symfony to make this achievable without needing to do so. Who knows if they will accept it. For now:

use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;

abstract class AbstractWebTestCase extends WebTestCase
{
    private KernelBrowser $client;
    private Ses…

Replies: 7 comments 15 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@nicodemuz
Comment options

@arderyp
Comment options

@stof
Comment options

stof Feb 15, 2023
Collaborator

@arderyp
Comment options

Comment options

You must be logged in to vote
1 reply
@arderyp
Comment options

Answer selected by arderyp
Comment options

You must be logged in to vote
10 replies
@dreis2211
Comment options

@arderyp
Comment options

@marien-probesys
Comment options

@dreis2211
Comment options

@dreis2211
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #46955 on July 17, 2022 14:14.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy