security:
    encoders:
        App\Entity\Usuario: sha512

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
    providers:
        main:
            entity: { class: App\Entity\Usuario, property: email }

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

        #api:
        #  pattern: ^/api                             # All URLs are protected
        #  security: false

        main:
            pattern: ^/api
            #anonymous: lazy
            logout: ~

            guard:
                authenticators:
                    - App\Security\TokenAuthenticator

            stateless: true

    access_control:
        - { path: ^/usuario/autenticar, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/usuario/loginRrss, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/usuario/olvidoContrasenna, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/usuario/registrar, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/usuario/activar, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/usuario/reenviar-codigo, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/empresa/listarTerminos, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api, roles: [ROLE_ADMIN, ROLE_USER]  }
