security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    encoders:
        App\Entity\Usager:
          algorithm: bcrypt

    providers:
        in_memory: { memory: ~ }
        our_db_provider:
          entity:
            class: App\Entity\Usager
            property: username
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: true
            logout:
              path: /logout
              target: /login
            # activate different ways to authenticate

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

            # https://symfony.com/doc/current/security/form_login_setup.html
            form_login:
              login_path: login_check
              check_path: login_check
              provider: our_db_provider
            json_login:
                check_path: ajaxlogin_check
                provider: our_db_provider

              #default_target_path: avis_liste



    # 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: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/ajaxlogin, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/inscription, roles: IS_AUTHENTICATED_ANONYMOUSLY }

        - { path: ^/circonscription, roles: ROLE_USER }
        - { path: ^/paiement, roles: ROLE_USER }
        - { path: ^/admin, roles: ROLE_ADMIN }
    role_hierarchy:
        ROLE_ADMIN : ROLE_USER
