From e378827baf20c9ace6c22e9d11c13ae02501e5c4 Mon Sep 17 00:00:00 2001 From: Maarten de Keizer Date: Mon, 3 Aug 2020 13:53:37 +0200 Subject: [PATCH] Proper handling of access denied exception when not matching expected type of access denied exception --- src/Security/AccessDeniedHandler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Security/AccessDeniedHandler.php b/src/Security/AccessDeniedHandler.php index b25edb71..d75b8e51 100644 --- a/src/Security/AccessDeniedHandler.php +++ b/src/Security/AccessDeniedHandler.php @@ -49,5 +49,7 @@ public function handle(Request $request, AccessDeniedException $accessDeniedExce 'message' => 'Gebruikerstype is onbekend. [' . $user->getEmail() . ']', ]), Response::HTTP_FORBIDDEN); } + + return new Response($accessDeniedException->getMessage(), Response::HTTP_FORBIDDEN); } }