security:
    role_hierarchy:
        ROLE_ADMIN: [ROLE_SUPER_ADMIN, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH,ROLE_USER]
    enable_authenticator_manager: true
    password_hashers:
        Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface: 'auto'
        App\Entity\User:
            algorithm: auto

    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        # used to reload user from session & other features (e.g. switch_user)
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email

    firewalls:


        dev:
            pattern: ^/_(profiler|wdt)
            security: false
        api:
            pattern: ^/api/v1/
            stateless: false
            entry_point: jwt
            json_login:
                check_path: /api/v1/authentication_token
                provider: app_user_provider
                username_path: email
                password_path: password
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
            jwt: ~



        main:
            stateless: false
            lazy: false
            switch_user: true

            provider: app_user_provider
            entry_point: form_login
            custom_authenticators:
                - App\Security\BackendAuthenticator
            form_login:
                check_path: app_login
                login_path: app_login
                default_target_path: /admin/
                use_referer: true

            logout:
                path: app_logout
                # where to redirect after logout
                target: app_login
            remember_me:
                secret: '%kernel.secret%'
                lifetime: 684888
                path: /


    access_control:
        - { path: ^/api/v1/docs, roles: PUBLIC_ACCESS } # Allows accessing the Swagger UI
        - { path: ^/api/v1/authentication_token, roles: PUBLIC_ACCESS }
        - { path: ^/api/v1/authentication_token/refresh, roles: PUBLIC_ACCESS }
        - { path: ^/register, roles: PUBLIC_ACCESS }
        - { path: ^/email/verify, roles: PUBLIC_ACCESS }
        - { path: ^/login, roles: PUBLIC_ACCESS }
        - { path: ^/client_location, roles: [ PUBLIC_ACCESS ] }
        - { path: ^/admin, roles: PUBLIC_ACCESS }
        - { path: ^/resetting, roles: IS_AUTHENTICATED_FULLY }
        - { path: ^/external-service/sms, roles: IS_AUTHENTICATED_FULLY }


