FriendsOfSymfony/FOSRestBundle — pull request #411 by RLovelett (2013-03-26 23:15:04+00:00)
Title: Handle AuthenticationException

In [this pull](https://github.com/symfony/symfony/pull/5705) request for symfony @lsmith77 suggests that FOSRestBundle pull request #308 is a probable resolution for his request. **However, in my experience it does not prevent the login redirection.**

Pull request #308 refers to the authorization layer and not the authentication layer (i.e., [AccessDeniedException](http://api.symfony.com/master/Symfony/Component/Security/Core/Exception/AccessDeniedException.html) and not [AuthenticationException](http://api.symfony.com/master/Symfony/Component/Security/Core/Exception/AuthenticationException.html)). AuthenticationException is the exception that, as far as I can tell, when thrown leads to the login redirection.

Therefore, in order to prevent the login redirection [AccessDeniedListener](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/EventListener/AccessDeniedListener.php) really needs to listen for AuthenticationException as well.

If such a patch was made would it be accepted?