diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 9f5f9191..1febcb52 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -15,13 +15,13 @@ security: security: false main: form_login: - login_path: app_login - check_path: app_login + login_path: app_admin_login + check_path: app_admin_login enable_csrf: true logout: - path: app_logout - target: app_login + path: app_admin_logout + target: app_admin_login # https://symfony.com/doc/current/security/impersonating_user.html # switch_user: true @@ -29,6 +29,7 @@ security: # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: + - { path: ^/admin/login, , roles: PUBLIC_ACCESS } - { path: ^/admin, roles: !php/enum App\Types\UserRoles::ROLE_API_USER->value } # - { path: ^/profile, roles: ROLE_USER } diff --git a/docker-compose.server.override.yml b/docker-compose.server.override.yml index b96a4ec7..1d7d2648 100644 --- a/docker-compose.server.override.yml +++ b/docker-compose.server.override.yml @@ -15,6 +15,14 @@ services: volumes: - "./.docker/data/rabbit:/var/lib/rabbitmq/mnesia" + nginx: + labels: + # Scope hosting by path prefix to allow shared hosting with legacy EventDB + # 'https://api.detskeriaarhus.dk/easyadmin/' -> Legacy EventDB + # 'https://api.detskeriaarhus.dk/admin/' -> EventDB v2 + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.rule=Host(`${COMPOSE_SERVER_DOMAIN}`) && PathPrefix(`/admin`)" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_SERVER_DOMAIN}`) && PathPrefix(`/admin`)" + supervisor: # @TODO: Create supervisor with ansible, when merged with Ture's PR image: itkdev/supervisor-php8.3:alpine diff --git a/src/Controller/LoginController.php b/src/Controller/Admin/LoginController.php similarity index 92% rename from src/Controller/LoginController.php rename to src/Controller/Admin/LoginController.php index e959287b..bcff4ce0 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/Admin/LoginController.php @@ -1,6 +1,6 @@ authenticationUtils->getLastAuthenticationError(); @@ -41,7 +41,7 @@ public function index(): Response ]); } - #[Route('/logout', name: 'app_logout', methods: ['GET'])] + #[Route('/admin/logout', name: 'app_admin_logout', methods: ['GET'])] public function logout(): never { throw new \Exception('Don\'t forget to activate logout in security.yaml');