security:
    enable_authenticator_manager: true

    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'

    providers:
        chain_provider:
            chain:
                providers: [in_memory, app_user_provider, uid_user_provider]
        in_memory:
            memory:
                users:
                    __NO_USER__:
                        password: ~
                        roles: ROLE_ANON
        uid_user_provider:
            id: uid_user_provider
        app_user_provider:
            entity:
                class: App\Entity\Account
                property: uid

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

        l3_firewall:
            pattern: ^/
            provider: chain_provider
            security: true
            custom_authenticators:
                - cas.security.authentication.authenticator
            logout:
                path: /logout

        l3_firewall2:
            pattern: ^/
            provider: chain_provider
            security: true
            custom_authenticators:
                - cas.security.authentication.authenticator
            logout:
                path: /logout

        main:
            pattern: ^/
            security: true
            lazy: true
            provider: chain_provider
            custom_authenticators:
                - cas.security.authentication.authenticator

        login:
            pattern: ^/api/login_check
            stateless: true
            provider: app_user_provider
            json_login:
                check_path: /api/login_check
                success_handler: lexik_jwt_authentication.handler.authentication_success
                failure_handler: lexik_jwt_authentication.handler.authentication_failure
                username_path: email
                password_path: password

        api:
            pattern: ^/api
            stateless: true
            provider: app_user_provider
            custom_authenticators:
                - lexik_jwt_authentication.jwt_manager

        orcid:
            pattern: ^/connect/orcid
            stateless: true
            provider: app_user_provider
            custom_authenticators:
                - App\Security\OrcidAuthenticator

    access_control:
        # - { path: ^/api/login_check, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        # - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
        # - { path: ^/connect/orcid, roles: IS_AUTHENTICATED_ANONYMOUSLY }

when@test:
    security:
        password_hashers:
            Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
                algorithm: auto
                cost: 4
                time_cost: 3
                memory_cost: 10

