security.yml 1.45 KB
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
    encoders:
        AppBundle\Entity\Usuarios:
            algorithm: bcrypt
    role_hierarchy:       
        ROLE_COORDINADOR_NACIONAL: [ROLE_COORDINADOR_REGIONAL]

    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
            our_db_provider:
                entity:
                    class: AppBundle:Usuarios
                    property: username

    firewalls:
        main:
            anonymous: ~
            http_basic: ~
            provider: our_db_provider
            form_login:
                login_path: /security/login
                check_path: /security/login
                csrf_token_generator: security.csrf.token_manager
            logout:
                path:   /logout
                target: /


            # activate different ways to authenticate

            # http_basic: ~
            # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate

            # form_login: ~
            # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }        
        - { path: ^/admin, roles: ROLE_ADMIN }
        - { path: ^/estudiante, roles: ROLE_CLIENTE }
        - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }