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

    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
      in_database:
          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
            provider: in_database

            form_login:
                login_path: security_login
                check_path: security_login
                csrf_token_generator: security.csrf.token_manager
                default_target_path: user_dashboard

            logout:
                path: security_logout
                target: security_login

        admin_area:
            pattern:    ^/admin
            http_basic: ~

            # 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

    # Easy way to control access for large sections of your site
    # Note: Only the *first* access control that matches will be used
    role_hierarchy:
        ROLE_ADMIN: ROLE_USER


    access_control:
      - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
   #- { path: ^/admin, roles: ROLE_ADMIN }
