security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        chain_provider:
            chain:
                providers: [in_memory,Commercials]
        in_memory:
            memory:
                users:
                    admin: 
                        password: test
                        roles: ROLE_ADMIN
        Commercials: 
            entity: { class: App\Entity\Commercial, property: mail }
            
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
            
        secured_area: 
            anonymous: lazy
            pattern: ^/
            provider: chain_provider
#            http_basic:
#                realm: 'Secured Admin Area'
#                provider: in_memory
            form_login: 
                check_path: login
                login_path: /
                
            logout:
                path: /logout
                target: /
            # 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

    # 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: ^/admin2, roles: ROLE_ADMIN }
         - { path: ^/order, roles: ROLE_COMMERCIAL }

    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        App\Entity\Commercial: 
            algorithm: bcrypt
            cost: 12