security:

    providers:
        user_db:
            entity: { class: Claroline\CoreBundle\Entity\User }

    encoders:
        Claroline\CoreBundle\Entity\User: sha512

    firewalls:
        install:
            pattern: ^/install
            security: false

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

        oauth_token:
            pattern:    ^/oauth/v2/token
            security:   false

        oauth_authorize:
            pattern:    ^/oauth/v2/auth
            form_login:
                check_path: /oauth/v2/auth_login_check
                login_path: /oauth/v2/auth_login
                use_referer: true
            anonymous: true

        api:
            pattern:    ^/api
            fos_oauth:  true
            stateless:  true

        main:
            pattern: ^/
            simple_form:
                authenticator: claroline.core_bundle.library.security.external_authenticator
                check_path: /login_check
            form_login:
                success_handler: claroline.authentication_handler
                failure_handler: claroline.security.ajax_authentication_failure_handler
            anonymous: ~
            logout: true
            switch_user: { role: ROLE_ADMIN, parameter: _switch }
            remember_me:
                key:      "%secret%"
                lifetime: 31536000 # 365 days
                path:     /
                domain:   ~

    access_decision_manager:
        allow_if_all_abstain: false

    access_control:
        - { path: ^/oauth/v2/auth_login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api,                  role: IS_AUTHENTICATED_FULLY }
        - { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/connect, role: IS_AUTHENTICATED_ANONYMOUSLY }
