Closed
Description
I have an Access Denied Handler
that is redirecting denied access exception to a controller to render the exception.
It use to work correctly, but I just notice that it's not anymore.
The error I get is:
FatalErrorException: Error: Call to undefined method Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel::forward() in /var/www/src/Acme/CoreBundle/Security/Authorization/Handler/AccessDeniedHandler.php line 30
Here is my service definition:
acme.security.access_denied_handler:
class: Acme\CoreBundle\Security\Authorization\Handler\AccessDeniedHandler
arguments: [@http_kernel]
tags:
- { name: kernel.event_listener, event: security.kernel_response, method: handle }
And the class:
<?php
namespace Acme\CoreBundle\Security\Authorization\Handler;
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class AccessDeniedHandler implements AccessDeniedHandlerInterface
{
private $kernel;
public function __construct(HttpKernelInterface $http_kernel)
{
$this->kernel = $http_kernel;
}
/**
* Handles an access denied failure.
*
* @param Request $request
* @param AccessDeniedException $accessDeniedException
*
* @return Response may return null
*/
public function handle(Request $request, AccessDeniedException $accessDeniedException)
{
return $this->kernel->forward('AcmeCoreBundle:Default:accessDenied', array(
'exception' => $accessDeniedException
));
}
}
Metadata
Metadata
Assignees
Labels
No labels