security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext

    providers:
        jwt_config_provider:
            memory:
                # custom options for that provider
                users:
                    admin:  { password: 'admin', roles: [ 'ROLE_USER' ] }

    firewalls:
        main:
            pattern: ^/files
            anonymous: ~

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

        login:
            pattern:  ^/rentalcars/login
            stateless: true
            anonymous: true
            json_login:
                check_path: /rentalcars/login
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
        api:
            pattern:  ^/rentalcars
            stateless: true
            anonymous: false
            provider: jwt_config_provider
            guard:
                authenticators:
                    - lexik_jwt_authentication.jwt_token_authenticator
        doc:
            anonymous: ~
            pattern: ^/drivecheck
      
            # 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: ^/rentalcars/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/rentalcars/search, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/drivecheck, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips:  [127.0.0.1,31.172.85.244,195.4.222.0/24,192.168.0.0/16,'90.153.5.135'] }
        - { path: ^/drivecheck, roles: ROLE_NO_ACCESS }
        - { path: ^/_profiler, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips:  [ 127.0.0.1,'90.153.5.135', '192.168.0.0/16' ] }
        - { path: ^/_profiler, roles: ROLE_NO_ACCESS }
        # - { path: ^/rentalcars, roles: IS_AUTHENTICATED_FULLY }

