security:
    encoders:
        App\Entity\User:
            algorithm: argon2i





    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        # used to reload user from session & other features (e.g. switch_user)
        app_user_provider:
            entity:
                class: App\Entity\User
                property: username
        # used to reload user from session & other features (e.g. switch_user)
        # used to reload user from session & other features (e.g. switch_user)
        # used to reload user from session & other features (e.g. switch_user)
        # used to reload user from session & other features (e.g. switch_user)
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: true
            guard:
                authenticators:
                    - App\Security\LoginFormAuthenticator
            logout:
                path:   app_logout
            remember_me:
                secret:   '%kernel.secret%'
                lifetime: 604800 
                path:     /
                # by default, the feature is enabled by checking a
                # checkbox in the login form (see below), uncomment the
                # following line to always enable it.
                #always_remember_me: true

                # where to redirect after logout
                # target: app_any_route

            # activate different ways to authenticate

            # http_basic: true
            # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate

            # form_login: true
            # https://symfony.com/doc/current/security/form_login_setup.html


    role_hierarchy:
        ROLE_ADMIN:         ROLE_GESTION
        ROLE_WEBMASTER:     ROLE_ADMIN
        #en tableau si plusieurs rôles : [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]


    # 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: ^/ajax, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/connexion, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        #- { path: ^/parametres, roles: ROLE_ADMIN }
        # - { path: ^/admin, roles: ROLE_ADMIN }
        # - { path: ^/profile, roles: ROLE_USER }
        #TOUS
        - { path: ^/, roles: IS_AUTHENTICATED_FULLY }
    
