security:
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    
    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email

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

        main:
            lazy: true
            provider: app_user_provider
            #switch_user: { role: ROLE_ALLOWED_TO_SWITCH }
            form_login:
                login_path: app_login
                check_path: app_login
                default_target_path: home
                always_use_default_target_path: false # Assure que la redirection après login est cohérente
                enable_csrf: true
            logout:
                path: app_logout
                target: app_login
            remember_me:
                secret: '%kernel.secret%'
                lifetime: 604800 # 1 semaine
                path: /
                httponly: true

    role_hierarchy:
        ROLE_ADMIN: [ROLE_USER]
        ROLE_SUPER_ADMIN: [ROLE_ADMIN]

    access_control:
        - { path: ^/admin, roles: ROLE_ADMIN }
        - { path: ^/profile, roles: ROLE_USER }
        #- { path: ^/switch_user, roles: ROLE_ALLOWED_TO_SWITCH }
