Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46071f3

Browse filesBrowse files
committed
[Security] made sure that we always replace the security access denied exception to an HTTP one
1 parent 7dc8901 commit 46071f3
Copy full SHA for 46071f3

File tree

1 file changed

+2
-4
lines changed
Filter options

1 file changed

+2
-4
lines changed

‎src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ public function onKernelException(GetResponseForExceptionEvent $event)
9797
return;
9898
}
9999
} elseif ($exception instanceof AccessDeniedException) {
100+
$event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception));
101+
100102
$token = $this->context->getToken();
101103
if (!$this->authenticationTrustResolver->isFullFledged($token)) {
102104
if (null !== $this->logger) {
@@ -129,8 +131,6 @@ public function onKernelException(GetResponseForExceptionEvent $event)
129131
$response = $event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
130132
$response->setStatusCode(403);
131133
} else {
132-
$event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception));
133-
134134
return;
135135
}
136136
} catch (\Exception $e) {
@@ -148,8 +148,6 @@ public function onKernelException(GetResponseForExceptionEvent $event)
148148
$this->logger->info(sprintf('Logout exception occurred; wrapping with AccessDeniedHttpException (%s)', $exception->getMessage()));
149149
}
150150

151-
$event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception));
152-
153151
return;
154152
} else {
155153
return;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.