[security] /api behind a firewall trigger an AccessDeniedException that is then transformed into a InsufficientAuthenticationException · Issue #519 · api-platform/api-platform · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[security] /api behind a firewall trigger an AccessDeniedException that is then transformed into a InsufficientAuthenticationException #519
When i try to access to /api/authors?page=1 then i expect an HTTP 403 but i get an HTTP 500 sent from Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException
If i look at the stack i can see that the original Exception is an Symfony\Component\Security\Core\Exception\AccessDeniedException thornw by the api-platform\core\src\Security\EventListener\DenyAccessListener.php
When i look at the Symfony Security Component documentation i see that i have to setup the status_code to get an HTTPException, or i'll get an AccessDeniedException.
So, is it possible to ask API-Platform to return a 403 ? and how can i do this ?
My setup is always a Symfony 4, with Flex, recipes Annotations, and bundles Security, SensioExtraFramework, a,d component api-platform from master
@dunglas seeing as the PR didn't get anywhere and this doesn't seem to be getting anywhere on the Symfony issue, what is the proper course of action here to get it fixed mainline?
Activity
dunglas commentedon Jan 15, 2018
We probably to add this exception there: https://github.com/api-platform/core/blob/master/src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php#L245-L248
Would you mind opening a pull request?
Rebolon commentedon Jan 15, 2018
I'll look at this tomorrow to try the modification and test it
Rebolon commentedon Jan 16, 2018
I also opened an issue on symfony there is a bug with the json_login security system that can impact api-platform: symfony/symfony#25806
asimonf commentedon Oct 1, 2018
@dunglas seeing as the PR didn't get anywhere and this doesn't seem to be getting anywhere on the Symfony issue, what is the proper course of action here to get it fixed mainline?
dunglas commentedon Oct 1, 2018
@asimonf IMO it should be fixed upstream in Symfony. I think that a PR would be very welcome.
alanpoulain commentedon Mar 1, 2021
Fixed in Symfony: symfony/symfony#28801.