security:
    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
    enable_authenticator_manager: true
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
    providers:
        # used to reload user from session & other features (e.g. switch_user)
        app_user_provider:
            entity:
                class: App\Entity\User
                property: username
    firewalls:
        api:
            pattern: ^/api/
            stateless: true
            provider: app_user_provider
            jwt: ~
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            lazy: true
            provider: app_user_provider
            form_login: ~
            custom_authenticator: 
                - App\Security\AppAuthenticator
                - App\Security\FacebookAuthenticator
                - App\Security\GoogleAuthenticator
            entry_point: form_login
            logout:
                path: app_logout
            json_login:
                check_path: /api_login_check
                username_path: username
                password_path: password
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
                # where to redirect after logout
                # target: app_any_route

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

            # https://symfony.com/doc/current/security/impersonating_user.html
            # switch_user: true
                # where to redirect after logout
                # target: app_any_route

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

            # 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: ^/admin, roles: ROLE_USER }
        - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/api,       roles: PUBLIC_ACCESS , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/login, roles: PUBLIC_ACCESS , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/logout, roles: PUBLIC_ACCESS , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/vendor, roles: ROLE_VENDOR , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/speeder, roles: ROLE_AGENT , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/pos/cart/checkout, roles: PUBLIC_ACCESS }
        - { path: ^/pos, roles: [ROLE_VENDOR,ROLE_ADMIN,ROLE_AGENT,ROLE_CUSTOMER] , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/admin, roles: ROLE_ADMIN , requires_channel: '%env(SECURE_SCHEME)%'}
        - { path: ^/, roles: PUBLIC_ACCESS , requires_channel: https}
        

         
        # - { path: ^/profile, roles: ROLE_USER }
