#security:
#   encoders:
#        Symfony\Component\Security\Core\User\User: plaintext

#    role_hierarchy:
#        ROLE_ADMIN:       ROLE_USER
#        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

#    providers:
#        in_memory:
#            users:
#                user:  { password: userpass, roles: [ 'ROLE_USER' ] }
#                admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }

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

#        login:
#            pattern:  ^/demo/secured/login$
#            security: false

#        secured_area:
#            pattern:    ^/demo/secured/
#            form_login:
#                check_path: /demo/secured/login_check
#                login_path: /demo/secured/login
#            logout:
#                path:   /demo/secured/logout
#                target: /demo/
            #anonymous: ~
            #http_basic:
            #    realm: "Secured Demo Area"

#    access_control:
        #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
        #- { path: ^/_internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }

security:
    providers:
        fos_userbundle:
            id: fos_user.user_manager
            
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    firewalls:
        # -> custom firewall for the admin area of the URL
#        admin:
#            switch_user:        true
#            context:            user
#            pattern:            /admin(.*)
#            form_login:
#                provider:       fos_userbundle
#                login_path:     /admin/login
#                use_forward:    false
#                check_path:     /admin/login_check
#                failure_path:   null
#                use_referer:    true
#            logout:
#                path:           /admin/logout
#                target:         /admin/login

#            anonymous:    true
        # -> end custom configuration
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                remember_me: true
            logout:       
                path:     /logout
                target:   /login
            anonymous:    true
            remember_me:
                lifetime:    8600
                key:         %secret% 

    access_control:
        - { path: ^/_wdt, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/_profiler, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/profile/, role: ROLE_USER }
        - { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
        - { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }

          
    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN
        SONATA:
            - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT