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

    providers:
        our_db_provider:
            entity:
                class: App\Entity\Usuario
                property: username

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            anonymous: ~
            provider: our_db_provider
            form_login:
                default_target_path: website_index

            logout:
                path:   /logout
                target: /

            remember_me:
                secret:   '%kernel.secret%'
                lifetime: 604800 # 1 week in seconds
                path:     /


            # 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
    access_control:
          - { path: ^/admin, roles: ROLE_ADMIN, requires_channel: '%env(SECURE_SCHEME)%'  }
          - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: '%env(SECURE_SCHEME)%' }
          - { path: ^/orden, roles: IS_AUTHENTICATED_REMEMBERED, requires_channel: '%env(SECURE_SCHEME)%' }

        #  - { path: ^/usuario/nuevo, allow_if: "not has_role('ROLE_USER')" } SOLO PARA NO LOGEADOS

        # - { path: ^/comprar, roles: [ROLE_ADMIN, ROLE_USER] } SIN REMEMBER
        # - { path: ^/comprar, roles: IS_AUTHENTICATED_REMEMBERED } CON REMEMBER
        # - { path: ^/comprar, roles: [ROLE_ADMIN, ROLE_USER] }
        # - { path: ^/admin, roles: ROLE_ADMIN }
        # - { path: ^/profile, roles: ROLE_USER }
