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

    # 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: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: true

            guard:
                authenticators:
                    - App\Security\LoginFormAuthenticator

            # activate different ways to authenticate

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

            form_login:
                # The route name that the login form submits to
                check_path: login
                # The name of the route where the login form lives
                # When the user tries to access a protected page, they are redirected here
                login_path: login
                # Secure the login form against CSRF
                # Reference: https://symfony.com/doc/current/security/csrf_in_login_form.html
                csrf_token_generator: security.csrf.token_manager

            logout:
                # The route name the user can go to in order to logout
                path: logout

                # The name of the route to redirect to after logging out
                target: 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: ^/admin-world, roles: ROLE_ADMIN_WORLD }
        - { path: ^/admin-country, roles: [ROLE_ADMIN_COUNTRY, ROLE_MANAGER] }
        - { path: ^/manager, roles: ROLE_MANAGER }
        - { path: ^/user, roles: ROLE_CANDIDAT }
