I'm trying to setup the FOSRestBundle to catch authentication exceptions. My config:
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
default_engine: php
format_listener:
default_priorities: ['json']
fallback_format: json
prefer_extension: false
access_denied_listener:
json: true
exception:
codes:
Symfony\Component\Security\Core\Exception\AccessDeniedException: 403
twig:
exception_controller: FOS\RestBundle\Controller\ExceptionController::showAction
This config will catch exceptions when they are thrown in a controller, but not when they are thrown from within the security component (i.e. if a user auth fails). Is something wrong with my config, or is the FOSRestBundle simply not designed to intercept exceptions at that point in the stack?
It's worth mentioning that I'm using a custom auth provider based on the WSSE tutorial here:
http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html