security:
    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    enable_authenticator_manager: true
    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
    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
        login:
            pattern: ^/security/login
            stateless: true
            provider: app_user_provider
            user_checker: App\Security\UserChecker
            json_login:
                check_path: /security/login
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
        api:
            stateless: true
            provider: app_user_provider
            jwt: ~
            entry_point: jwt
            switch_user: { parameter: X-Switch-User }
            logout:
                path: /security/logout
                delete_cookies: ['PHPSESSID', 'BEARER']
                invalidate_session: true
            refresh_jwt:
                check_path: /token/refresh
    #        login:
    #            pattern: ^/login
    #            stateless: true
    #            user_checker: App\Security\UserChecker
    #            json_login:
    #                check_path: /login_check
    #                success_handler: lexik_jwt_authentication.handler.authentication_success
    #                failure_handler: lexik_jwt_authentication.handler.authentication_failure
    #
    #        api:
    #            stateless: true
    #            provider: app_user_provider
    #            jwt: ~
    #            switch_user: { parameter: X-Switch-User }

    access_control:
        - { path: ^/docs, roles: PUBLIC_ACCESS } # Allows accessing API documentations and Swagger UI
        - { path: ^/login, roles: PUBLIC_ACCESS }
        - { path: ^/login_check_ksdo, roles: PUBLIC_ACCESS }
        - { path: ^/reset_password, roles: PUBLIC_ACCESS }
        - { path: ^/reset_password_check_token, roles: PUBLIC_ACCESS }
        - { path: ^/reset_password_change_password, roles: PUBLIC_ACCESS }
        - { path: ^/,       roles: IS_AUTHENTICATED_FULLY }

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