#security:
#    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
##    enable_authenticator_manager: true
#
#    password_hashers:
#        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
#    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
#    providers:
#        # used to reload user from session & other features (e.g. switch_user)
#        app_user_provider:
#            entity:
#                class: App\Entity\User
#                property: email
#
#    role_hierarchy:
#        ROLE_EDITOR: ROLE_MEMBER
#        ROLE_ADMIN: ROLE_EDITOR
#
#    firewalls:
#        dev:
#            pattern: ^/(_(profiler|wdt)|css|images|js)/
#            security: false
#        main:
#            lazy: true
#            provider: app_user_provider
##            pattern: ^/
#            form_login:
#                login_path: app_login
#                check_path: app_login
#                enable_csrf: true
#            logout:
#                path: app_logout
#                # where to redirect after logout
#                target: /
#
#            # 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:
#        # Pages publiques
#        - { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
#        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
#
#        # Page membre
#        - { path: ^/membre, roles: ROLE_MEMBER }
#
#        # Page editor
#        - { path: ^/editor, roles: ROLE_EDITOR }
#
#        # Page admin
#        - { path: ^/admin, roles: ROLE_ADMIN }
#
#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

#security:
#    password_hashers:
#        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
#
#    providers:
#        app_user_provider:
#            entity:
#                class: App\Entity\User
#                property: email   # on cherche des users par email
#
#    role_hierarchy:
#        ROLE_EDITOR: ROLE_MEMBER
#        ROLE_ADMIN: ROLE_EDITOR
#
#    firewalls:
#        # Routes et assets sur  dev
#        dev:
#            pattern: ^/(_(profiler|wdt)|css|images|js)/
#            security: false
#
#        # Home pubplique(OnePage)
#        public:
#            pattern: ^/$
#            security: false
#
#        # Firewall principal
#        main:
#            lazy: true
#            provider: app_user_provider
#            user_checker: App\Security\UserChecker
#
#            form_login:
#                login_path: app_login
#                check_path: app_login
#                enable_csrf: true
#                username_parameter: _email     #  _email
#                password_parameter: _password
#
#            remember_me:                     #  "Se souvenir de moi"
#                secret: '%kernel.secret%'
#                lifetime: 2592000              # 30 jours en secondes
#                path: /
#                name: REMEMBERME
#
#            logout:
#                path: app_logout
#                target: app_home
#
#    access_control:
#        # Seuls les membres approuvés peuvent accéder aux pages /membre
#        - { path: ^/membre, roles: ROLE_MEMBER }
#
#
#when@test:
#    security:
#        password_hashers:
#            Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
#                algorithm: auto
#                cost: 4
#                time_cost: 3
#                memory_cost: 10

security:
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'

    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email

    role_hierarchy:
        ROLE_EDITOR: ROLE_MEMBER
        ROLE_ADMIN: ROLE_EDITOR

    firewalls:

        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            lazy: true
            provider: app_user_provider
            user_checker: App\Security\UserChecker

            form_login:
                login_path: app_login
                check_path: app_login
                enable_csrf: true
                username_parameter: _email
                password_parameter: _password

            remember_me:
                secret: '%kernel.secret%'

                lifetime: 2592000 #30 jours#

                path: /
                name: REMEMBERME
                # always_remember: true # (optionnel)

            logout:
                path: app_logout
                target: app_home

    access_control:

        # Seuls les membres approuvés peuvent accéder aux pages /membre
        - { path: ^/membre, roles: ROLE_MEMBER }

        # Routes publiques
        - { path: ^/login, roles: PUBLIC_ACCESS }
        - { path: ^/logout, roles: PUBLIC_ACCESS }
        - { path: ^/register, roles: PUBLIC_ACCESS }        # ok
        - { path: ^/reset-password, roles: PUBLIC_ACCESS }  # ok
        - { path: ^/membre, roles: ROLE_MEMBER }            # ok
        - { path: ^/admin, roles: ROLE_EDITOR }            # ok
        - { path: ^/, roles: PUBLIC_ACCESS }                # ok

