symfony-docs icon indicating copy to clipboard operation
symfony-docs copied to clipboard

[Security] Added a note regarding the loginUser() method

Open artyuum opened this issue 4 years ago • 1 comments

As @javiereguiluz stated, this method won't work for 100% of Symfony users. This is my case. I'm testing some protected API routes and the firewall is using a custom authenticator that relies on a custom header called "x-api-key". After spending hours trying to understand what I did wrong in my tests, I decided to dig into the code that defines the loginUser() method and noticed that it can only work with session-based authentication.

This little note could have saved me some time, so I believe it could help future users as well who are in the same case as me.

artyuum avatar Nov 04 '21 16:11 artyuum

One test failed but I don't think it's related to the changes brought by this PR.

artyuum avatar Jul 13 '22 12:07 artyuum

Thanks @artyuum and I'm sorry it took us so long to merge this.

javiereguiluz avatar Sep 22 '22 13:09 javiereguiluz

No problem, thank you all for reviewing and merging.

artyuum avatar Sep 22 '22 13:09 artyuum