security:
  encoders:
    App\Entity\Tusuario:
      algorithm: bcrypt
      cost: 13
  providers:
    api_user_provider:
      entity:
        class: App\Entity\Tusuario
        property: usuario
  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false

    ciudad:
      pattern:   ^/api/v1/ciudades
      stateless: true
      anonymous: true
      
    register:
      pattern:   ^/api/v1/usuario/register
      stateless: true
      anonymous: true


    login:
      pattern:   ^/api/v1/usuario/login
      stateless: true
      anonymous: true

    api:
      pattern:   ^/api/v1
      stateless: true
      anonymous: false
      provider: api_user_provider
      guard:
        authenticators:
          - lexik_jwt_authentication.jwt_token_authenticator

    login2:
      anonymous: true
      guard:
        authenticators:
          - App\Security\CustomAuthAuthenticator
      logout:
        path: app_logout
      # 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: ^/api/v1/usuario/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/v1/usuario/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api/v1/ciudades, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    #- { path: ^/api/v1/empresa,       roles: admin }
    - { path: ^/api/v1,       roles: IS_AUTHENTICATED_FULLY }
    #- { path: ^/api/v1/usuario/register/facebook, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    # - { path: /api/v1/usuario, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin, roles: ROLE_admin }