security:
    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
            algorithm: argon2id

    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email

    firewalls:
        dev:
            pattern: ^/(_profiler|_wdt|css|js|images|assets|build)/
            security: false
        main:
            lazy: true
            provider: app_user_provider
            access_denied_handler: App\Security\AccessDeniedFlashRedirectHandler
            form_login:
                login_path: app_login
                check_path: app_login
                enable_csrf: true
                default_target_path: app_home
            logout:
                path: app_logout
                target: app_login
            remember_me:
                secret: '%kernel.secret%'
                lifetime: 2592000   # 30 jours
                path: /
                secure: auto
                samesite: lax

    access_control:
        - { path: ^/login$, roles: PUBLIC_ACCESS }
        - { path: ^/logout$, roles: PUBLIC_ACCESS }
        - { path: ^/forgot-password, roles: PUBLIC_ACCESS }
        - { path: ^/reset-password, roles: PUBLIC_ACCESS }
        - { path: ^/admin/organizations$, roles: ROLE_SUPERADMIN }
        - { path: ^/admin/organizations/new, roles: ROLE_SUPERADMIN }
        - { path: ^/admin/organizations/\d+/delete, roles: ROLE_SUPERADMIN }
        - { path: ^/admin/rental-platforms, roles: ROLE_SUPERADMIN }
        - { path: ^/admin/permissions, roles: ROLE_SUPERADMIN }
        - { path: ^/admin/organizations, roles: ROLE_USER }
        - { path: ^/admin/bank-accounts, roles: ROLE_USER }
        - { path: ^/admin/memberships, roles: ROLE_USER }
        - { path: ^/admin/properties, roles: ROLE_USER }
        - { path: ^/admin/property-platform-listings, roles: ROLE_USER }
        - { path: ^/admin/imports, roles: ROLE_USER }
        - { path: ^/admin/transactions, roles: ROLE_USER }
        - { path: ^/admin/tags-categories, roles: ROLE_USER }
        # Suggestions / création tags depuis la liste transactions (contrôleur : voter DELEGATABLE_ADMIN_TRANSACTIONS)
        - { path: ^/admin/tags, roles: ROLE_USER }
        - { path: ^/admin, roles: ROLE_SUPERADMIN }
        - { path: ^/, roles: ROLE_USER }

when@test:
    security:
        password_hashers:
            Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
                algorithm: auto
                cost: 4
                time_cost: 3
                memory_cost: 10
