##
#  Copyright © ProgramCMS. All rights reserved.
#  See COPYING.txt for license details.
#
#  Developed by Mohamed EL QUCHIRI <elquchiri@gmail.com>
##
security:
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'

    providers:
        users_in_memory: { memory: null }
        app_user_provider:
            entity:
                class: ProgramCms\UserBundle\Entity\UserEntity
                property: email
        app_admin_provider:
            entity:
                class: ProgramCms\AdminBundle\Entity\AdminUser
                property: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        admin:
            pattern: ^/admin/
            lazy: true
            provider: app_admin_provider
            custom_authenticator: ProgramCms\AdminBundle\Security\LoginAuthenticator
            logout:
                path: adminhtml_admin_systemaccount_logout
                target: adminhtml_admin_index_index
            access_denied_handler: ProgramCms\AclBundle\Security\AccessDeniedHandler
        main:
            lazy: true
            provider: app_user_provider
            custom_authenticator: ProgramCms\UserBundle\Security\LoginAuthenticator
            remember_me:
                secret: '%kernel.secret%'
                lifetime: 604800 # 1 week in seconds
                signature_properties: ['password', 'updated_at']
            logout:
                path: frontend_user_account_logout

    access_control:
        - { path: '^/admin/admin/index/index', roles: PUBLIC_ACCESS }
        - { path: '^/admin/admin/recovery/index', roles: PUBLIC_ACCESS }
        - { path: '^/admin', roles: ROLE_ADMIN }

    access_decision_manager:
        strategy: unanimous
        allow_if_all_abstain: false

when@test:
    security:
        password_hashers:
            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
