From 44c415860205116139f6307deac6e4f066d70c94 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Wed, 3 Apr 2019 20:16:34 +0300 Subject: [PATCH] Fixing automatic replacing of AccessDeniedExceptions with InsufficientAuthenticationException in Symfony\Component\Security\Http\Firewall\ExceptionListener::handleAccessDeniedException(). --- app/config/security.yml | 9 ++++++++- .../PointToolsBundle/Controller/PostController.php | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/config/security.yml b/app/config/security.yml index b891000..018cccf 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -9,4 +9,11 @@ security: security: false default: - anonymous: ~ + # Needs to be changed if authentication is added + # Also it needs to be carefully checked that after enabling security here + # \Symfony\Component\Security\Http\Firewall\ExceptionListener::handleAccessDeniedException() doesn't start to replace 403 by 401 exceptions + # for all users + # For example \Skobkin\Bundle\PointToolsBundle\Controller\PostController::showAction() can return AccessDeniedException and this logic must be saved + # After enabling authentication + security: false + #anonymous: true diff --git a/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php b/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php index 55623ea..0f2c379 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Controller/PostController.php @@ -12,8 +12,6 @@ class PostController extends AbstractController { /** * @ParamConverter("post", class="SkobkinPointToolsBundle:Blogs\Post") - * - * @return Response */ public function showAction(Post $post, PostRepository $postRepository): Response {