security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        qbabit_provider:
            entity:
                class: QbaBit\SecurityBundle\Entity\Usuario
                property: email
        #in_memory: { memory: ~ }
    encoders:
        QbaBit\SecurityBundle\Entity\Usuario: bcrypt
#            algorithm: pbkdf2
#            hash_algorithm: sha512
#            encode_as_base64: true
#            iterations: 1000
#            key_length: 40


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

        backend:
            pattern: ^/admin
            anonymous: true
            provider: qbabit_provider
            user_checker: qbabit.security.user_checker
            form_login:
                login_path: seguridad_login
                check_path: seguridad_login_check
                default_target_path: qb_dashboard
            logout:
                path: seguridad_logout
                target: seguridad_login


        main:
            pattern: ^/
            anonymous: true
#            user_checker: qbabit.security.user_checker
            json_login:
                check_path: qb_inmobiliaria_login
            form_login:
                login_path: qb_inmobiliaria_login
                check_path: qb_inmobiliaria_check
                default_target_path: qb_inmobiliaria_index
            logout:
                path: qb_inmobiliaria_logout
                target: qb_inmobiliaria_login
            guard:
                authenticators:
                    - qbabit.security.facebook
            # activate different ways to authenticate

            # http_basic: true
            # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate

            # form_login: true
            # https://symfony.com/doc/current/security/form_login_setup.html

    # 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: ^/admin/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/restaurar/recuperar, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/encoders/json-childs, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/images/delete_one, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/*, roles: [ROLE_ADMIN] }
        - { path: ^/panel/*, roles: [ROLE_USER] }
        # - { path: ^/admin, roles: ROLE_ADMIN }
        # - { path: ^/profile, roles: ROLE_USER }
