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
This PR was merged into the 2.x branch.
Discussion
----------
remove previous exception, add tests for access denied listener
This PR exprovides an alternative fix for #1692
I tried to decorate the security component exception listener but it does not seem possible since the Firewall context has a typehint on the class (not an interface) on the exception listener (https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php#L30) but the class is also marked as `@final` (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php#L43). As such the fix is essentially a hack by not pass the previous exception to prevent the core listener from doing anything.
open questions
* [ ] instead of removing the previous exception we could also try to call `\Symfony\Component\Security\Http\Firewall\ExceptionListener::unregister()` on the given firewall instead but not sure how easy it is to find the relevant firewall
* [ ] yet another approach could be to somehow try and handle this in our ExceptionListener if #2108 is merged. ie. use the AccessDeniedListener to set something on the request, so that we do not use the exception that was set in the core security exception listener but the one from the rest bundle AccessDeniedListener
Commits
-------
0ceb3e5 fix access denied listener, add tests
0 commit comments