security: # Login controller already calls $session->migrate(true) on login. # Keeping 'migrate' would regenerate the session ID on every authenticated # API request, which breaks concurrent requests from the SPA (race condition). session_fixation_strategy: none # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' App\Entity\Profile: algorithm: auto # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider providers: app_user_provider: entity: class: App\Entity\Profile property: email firewalls: dev: # Ensure dev tools and static assets are always allowed pattern: ^/(_profiler|_wdt|assets|build)/ security: false session_public: pattern: ^/api/session/profiles?$ security: false mcp: pattern: ^/_mcp stateless: true custom_authenticators: - App\Mcp\Security\McpHeaderAuthenticator api: pattern: ^/api stateless: false custom_authenticators: - App\Security\SessionProfileAuthenticator main: lazy: true provider: app_user_provider role_hierarchy: ROLE_ADMIN: ROLE_GESTIONNAIRE ROLE_GESTIONNAIRE: ROLE_VIEWER ROLE_VIEWER: ROLE_USER # Note: Only the *first* matching rule is applied access_control: - { path: ^/api/session/profile$, roles: PUBLIC_ACCESS } - { path: ^/api/session/profiles, roles: PUBLIC_ACCESS, methods: [GET] } - { path: ^/api/admin, roles: ROLE_ADMIN } - { path: ^/api/docs, roles: PUBLIC_ACCESS } - { path: ^/api/health$, roles: PUBLIC_ACCESS } - { path: ^/api/maintenance/check$, roles: PUBLIC_ACCESS } - { path: ^/_mcp, roles: ROLE_USER } - { path: ^/docs, roles: PUBLIC_ACCESS } - { path: ^/contexts, roles: PUBLIC_ACCESS } - { path: ^/\.well-known, roles: PUBLIC_ACCESS } - { path: ^/api, roles: ROLE_VIEWER } when@test: security: password_hashers: # Password hashers are resource-intensive by design to ensure security. # In tests, it's safe to reduce their cost to improve performance. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: algorithm: auto cost: 4 # Lowest possible value for bcrypt time_cost: 3 # Lowest possible value for argon memory_cost: 10 # Lowest possible value for argon