security:
    # https://symfony.com/doc/current/security/experimental_authenticators.html
    enable_authenticator_manager: true
    # https://symfony.com/doc/current/security.html#c-hashing-passwords
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    providers:
        our_db_provider:
            entity:
                class: App\Entity\Utilisateur
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            pattern: ^/
            provider: our_db_provider
            user_checker: App\Security\UserChecker
            form_login:
                login_path: login
                check_path: login
                enable_csrf: true
                default_target_path: home
                always_use_default_target_path: true
            logout:
                path: /logout
                invalidate_session: true
                target: /login
            entry_point: form_login

    # 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: ^/login, roles: PUBLIC_ACCESS }
         - { path: ^/reset-password, roles: PUBLIC_ACCESS }
         - { path: ^/mentions-legales, roles: PUBLIC_ACCESS }
         - { path: ^/bo, roles: ROLE_ADMIN }
         - { path: ^/, roles: ROLE_USER }

    role_hierarchy:
        ROLE_ADMIN: [ROLE_ENSEIGNANT]
        ROLE_ENSEIGNANT: ROLE_USER
        ROLE_ETUDIANT: ROLE_USER


when@test:
    security:
        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
