Skip to content

Commit

Permalink
Merge pull request #41 from itk-dev/feature/1284_url_path_updates
Browse files Browse the repository at this point in the history
1284: Added PethPrefix scope to traefik rules to allow co-hosting with legacy eventdb
  • Loading branch information
turegjorup authored May 3, 2024
2 parents 5f85e2a + 00d6de7 commit b417f9a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ See [keep a changelog] for information about writing changes to this log.
- Updated feed mapping to support data migration
- Added migrate command fro tags from legacy db
- Updated elastic indexes to support the API
- Added PethPrefix scope to traefik rules to allow co-hosting with legacy eventdb

[keep a changelog]: https://keepachangelog.com/en/1.1.0/
[unreleased]: https://github.com/itk-dev/event-database-imports/compare/main...develop
9 changes: 5 additions & 4 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ 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

# 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 }

Expand Down
8 changes: 8 additions & 0 deletions docker-compose.server.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Controller;
namespace App\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -15,7 +15,7 @@ public function __construct(
) {
}

#[Route('/login', name: 'app_login')]
#[Route('/admin/login', name: 'app_admin_login')]
public function index(): Response
{
$error = $this->authenticationUtils->getLastAuthenticationError();
Expand All @@ -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');
Expand Down

0 comments on commit b417f9a

Please sign in to comment.