diff --git a/config/packages/security.yaml b/config/packages/security.yaml index bf768d9..a5dc55c 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -21,6 +21,7 @@ security: check_path: app_user_login logout: path: app_user_logout + access_denied_url: /access-denied # activate different ways to authenticate # https://symfony.com/doc/current/security.html#the-firewall diff --git a/config/routes.yaml b/config/routes.yaml index 9286e81..7352df3 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,7 @@ controllers: - resource: ../src/Controller/ - type: attribute + resource: ../src/Controller/ + type: attribute + +access_denied: + path: /access-denied + controller: App\Controller\ErrorController::accessDenied diff --git a/src/Controller/ErrorController.php b/src/Controller/ErrorController.php new file mode 100644 index 0000000..ad1049d --- /dev/null +++ b/src/Controller/ErrorController.php @@ -0,0 +1,19 @@ +render('error/access_denied.html.twig', []); + } +} diff --git a/templates/error/access_denied.html.twig b/templates/error/access_denied.html.twig new file mode 100644 index 0000000..6974ea9 --- /dev/null +++ b/templates/error/access_denied.html.twig @@ -0,0 +1 @@ +
src/Controller/ErrorController.phptemplates/error/index.html.twig