security:
    enable_authenticator_manager: true
    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
    providers:
        users_in_memory: { memory: null }
        sonata_user_bundle:
            id: sonata.user.security.user_provider
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        admin:
            lazy: true
            pattern: /admin(.*)
            provider: sonata_user_bundle
            context: user
            switch_user: true
            form_login:
                login_path: sonata_user_admin_security_login
                check_path: sonata_user_admin_security_check
                default_target_path: sonata_admin_dashboard
            logout:
                path: sonata_user_admin_security_logout
                target: sonata_user_admin_security_login
            remember_me:
                #secret: "%env(APP_SECRET)%"
                secret: "123456"
                lifetime: 2629746
                path: /admin
        main:
            lazy: true
            provider: sonata_user_bundle
            logout:
                path: app_logout
                # where to redirect after logout
                target: app_login
            custom_authenticator: App\Security\AppCustomAuthenticator

            # activate different ways to authenticate
            # https://symfony.com/doc/current/security.html#the-firewall

            # 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$, role: PUBLIC_ACCESS }
        - { path: ^/admin/logout$, role: PUBLIC_ACCESS }
        - { path: ^/admin/login_check$, role: PUBLIC_ACCESS }
        - { path: ^/admin/request$, role: PUBLIC_ACCESS }
        - { path: ^/admin/check-email$, role: PUBLIC_ACCESS }
        - { path: ^/admin/reset/.*$, role: PUBLIC_ACCESS }
        - { path: ^/admin/, role: [ROLE_ADMIN,ROLE_GESTIONNAIRE,ROLE_RECEPTIONNISTE,ROLE_ALTERNANCE,ROLE_COMMERCIAL,ROLE_ASSISTANCE] }


        - { path: ^/informations, role: ROLE_CLIENT }
        - { path: ^/points, role: ROLE_CLIENT }
        - { path: ^/convertir-points, role: ROLE_CLIENT }
        - { path: ^/reservations, role: ROLE_CLIENT }
        - { path: ^/reservations-detail, role: ROLE_CLIENT }
        - { path: ^/reservations/voucher, role: ROLE_CLIENT }
        - { path: ^/abonnement, role: ROLE_CLIENT }


    role_hierarchy:
        ROLE_SUPER_ADMIN: [ROLE_ADMIN]
        ROLE_ADMIN: [ROLE_GESTIONNAIRE,ROLE_RECEPTIONNISTE,ROLE_ALTERNANCE,ROLE_COMMERCIAL,ROLE_ASSISTANCE]
        ROLE_GESTIONNAIRE:   []
        ROLE_RECEPTIONNISTE: []
        ROLE_ALTERNANCE:     []
        ROLE_COMMERCIAL:     []
        ROLE_ASSISTANCE:     [ROLE_GESTIONNAIRE]


when@test:
    security:
        acl:
            connection: default
        password_hashers:
            # By default, password hashers are resource intensive and take time. This is
            # important to generate secure password hashes. In tests however, secure hashes
            # are not important, waste resources and increase test times. The following
            # reduces the work factor to the lowest possible values.
            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