security:
    #    access_decision_manager:
    #        strategy: unanimous
    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    # 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)
        users_in_memory:
            memory:
                users:
                    'support@sylapps.com': { roles: [ 'ROLE_SUPER_ADMIN' ], password: '$2y$13$lM0ht2ENt/TiQu939ip.1O2itE3gVzmm.VsY9kcHbVjvufLZegfQS' }
                    'support+boe@sylapps.com': { roles: [ 'ROLE_PRO_SUPPORT' ], password: '$2y$13$lM0ht2ENt/TiQu939ip.1O2itE3gVzmm.VsY9kcHbVjvufLZegfQS' }
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email
        app_user_providers:
            chain:
                providers: [ 'users_in_memory', 'app_user_provider' ]
    role_hierarchy:
        ROLE_PRO: ROLE_USER
        ROLE_PRO_SUPPORT: [ ROLE_PRO, ROLE_ALLOWED_TO_SWITCH ]
        ROLE_ADMIN: ROLE_PRO
        ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        media:
            pattern: ^/(build|media|media\/cache\/resolve|u)/
            security: false
        bog:
            host: '^%hosts.bog%$'
            lazy: true
            switch_user: true
            provider: app_user_providers
            form_login:
                login_path: bog_login
                check_path: bog_login
                enable_csrf: true
            logout:
                path: bog_logout
            remember_me:
                name: bog
                secure: true
                secret: '%kernel.secret%'
                lifetime: 604800
                path: /
        boe:
            host: '^%hosts.boe%\.'
            lazy: true
            switch_user: true
            provider: app_user_providers
            form_login:
                login_path: boe_login
                check_path: boe_login
                enable_csrf: true
            logout:
                path: boe_logout
            remember_me:
                name: boe
                secure: true
                secret: '%kernel.secret%'
                lifetime: 604800
                path: /
        main:
            lazy: true

    # 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: ^/(login|reset-password|logout), roles: PUBLIC_ACCESS, host: '%hosts.bog%' }
        - { path: ^/, roles: ROLE_ADMIN, host: '%hosts.bog%' }
        - { path: ^/(login|reset-password|logout), roles: PUBLIC_ACCESS, host: '^%hosts.boe%\.' }
        - { path: ^/, roles: ROLE_PRO, host: '^%hosts.boe%\.' }

when@test:
    security:
        password_hashers:
            # By default, password hashers are resource intensive and take time. This is
            # important to generate secure password hashes. In tests however, secure hashes
            # are not important, waste resources and increase test times. The following
            # reduces the work factor to the lowest possible values.
            Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
                algorithm: auto
                cost: 4 # Lowest possible value for bcrypt
                time_cost: 3 # Lowest possible value for argon
                memory_cost: 10 # Lowest possible value for argon
