security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        db_provider:
            entity:
                class: App\Entity\User
                property: email
    firewalls:
        login:
            provider: db_provider
            pattern:  ^/api/user/login
            stateless: true
            anonymous: true
            json_login:
                check_path:               /api/user/login
                success_handler:          lexik_jwt_authentication.handler.authentication_success
                failure_handler:          lexik_jwt_authentication.handler.authentication_failure

        reset_password:
            pattern: ^/api/user/password/reset
            anonymous: true

        confirm_new_password:
            pattern: ^/api/user/password/confirm
            anonymous: true

        webhooks:
            pattern:  ^/api/webhook
            security: false

        api:
            provider: db_provider
            pattern:   ^/api
            stateless: true
            guard:
                authenticators:
                - lexik_jwt_authentication.jwt_token_authenticator

        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            anonymous: true

    access_control:
        - { path: ^/_profiler, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [192.168.240.1, 127.0.0.1, 185.49.31.225] }
        - { path: ^/_profiler, roles: ROLE_NO_ACCESS }
        - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/user/password/reset, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/user/password/confirm, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api,       roles: IS_AUTHENTICATED_FULLY }

    encoders:
        App\Entity\User:
            algorithm: bcrypt
            cost: 12