Skip to content

Commit

Permalink
[Security] made sure that we always replace the security access denie…
Browse files Browse the repository at this point in the history
…d exception to an HTTP one
  • Loading branch information
fabpot committed Jul 13, 2012
1 parent 7dc8901 commit 46071f3
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -97,6 +97,8 @@ public function onKernelException(GetResponseForExceptionEvent $event)
return;
}
} elseif ($exception instanceof AccessDeniedException) {
$event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception));

$token = $this->context->getToken();
if (!$this->authenticationTrustResolver->isFullFledged($token)) {
if (null !== $this->logger) {
Expand Down Expand Up @@ -129,8 +131,6 @@ public function onKernelException(GetResponseForExceptionEvent $event)
$response = $event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
$response->setStatusCode(403);
} else {
$event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception));

return;
}
} catch (\Exception $e) {
Expand All @@ -148,8 +148,6 @@ public function onKernelException(GetResponseForExceptionEvent $event)
$this->logger->info(sprintf('Logout exception occurred; wrapping with AccessDeniedHttpException (%s)', $exception->getMessage()));
}

$event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception));

return;
} else {
return;
Expand Down

0 comments on commit 46071f3

Please sign in to comment.