imports:
    - { resource: parameters.yml }

security:
    encoders:
         Imax\UserBundle\Entity\User: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       [ROLE_AUTHOR, ROLE_CLIENT, ROLE_ALLOWED_TO_SWITCH]
    
    providers:
        database_users:
             entity: { class: ImaxUserBundle:User, property: email }

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

        main:
            pattern: ^/
            anonymous: true
            
            form_login:
                 check_path: imax_security_login_check
                 login_path: imax_security_login
                
                 csrf_token_generator: security.csrf.token_manager
                
                 default_target_path: imax_site_homepage
                 always_use_default_target_path: false

            logout: 
                 path: imax_security_logout
                 target: imax_site_homepage

            remember_me:
                secret: '%secret%'
                lifetime: 604800 # 1 week in seconds
                path: /

    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, roles: ROLE_ADMIN }