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

    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        #users_in_memory: { memory: null }
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: true
            guard:
                authenticators:
                    - App\Security\LoginAuthenticator
            logout:
                path: app_logout
                # where to redirect after logout
                target: index

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

            # https://symfony.com/doc/current/security/impersonating_user.html
            # switch_user: true

            remember_me:
                secret:   '%kernel.secret%'
                lifetime: 604800 # 1 week in seconds
                path:     /

    # 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, roles: ROLE_ADMIN }
        # - { path: ^/profile, roles: ROLE_USER }
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/app/, roles: IS_AUTHENTICATED_FULLY }

    role_hierarchy:
        ROLE_DDD: ROLE_USER
        ROLE_CSPAT: ROLE_DDD
        ROLE_MANAGER: ROLE_USER
        ROLE_ADMIN: [ROLE_MANAGER, ROLE_DPP, ROLE_FOCAL]