security:
    providers:
        chain_provider:
            chain:
                providers: [saml, fos_userbundle]
        saml:
            id: saml.saml_user_provider
        fos_userbundle:
            id: fos_user.user_provider.username_email
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt|error)|css|images|js)/
            security: false
        webservice_secured:
            pattern: ^/{1}\z
            stateless: true
            webservice: true
        uidentify_secured:
            pattern:   /api/v1/.*
            stateless: true
            uidentify:
        logout:
            pattern: ^/admin/logout
            security: false
        saml_auth:
            request_matcher: saml_request_matcher
            provider: saml
            stateless: true
            saml: true
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                login_path: /user/login
                check_path: /user/login_check
                default_target_path: _admin_backend_index
                always_use_default_target_path: true
                #csrf_token_generator: security.csrf.token_manager
            logout:
                path: fos_user_security_logout
                target: _admin_backend_welcome
            anonymous: true
    access_control:
        # URL of FOSUserBundle which need to be available to anonymous users
        - { path: ^/_wdt, role: ROLE_USER }
        - { path: ^/_profiler, role: ROLE_USER }
        - { path: ^/user/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/user/logout, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: ROLE_ADMIN }
        - { path: ^/resetting, role: ROLE_ADMIN }
        - { path: ^/admin/welcome$, role: ROLE_USER }
        # -> custom access control for the admin area of the URL
        - { path: ^/admin/webservice, role: ROLE_USER_ADMIN }
        - { path: ^/admin/service, role: ROLE_SERVICE_ADMIN }
        - { path: ^/admin/token, role: ROLE_SERVICE_ADMIN }
        - { path: ^/admin/systemlog, role: ROLE_SERVICE_ADMIN }
        - { path: ^/admin/security, role: ROLE_SUPER_ADMIN }
        - { path: ^/admin, role: ROLE_USER }
        - { path: ^/demo, role: ROLE_SERVICE_ADMIN }
        - { path: ^/help, role: ROLE_USER }
    role_hierarchy:
        ROLE_ADMIN:         ROLE_USER
        ROLE_API:           ROLE_ADMIN
        ROLE_WEBSERVICE:    ROLE_ADMIN
        ROLE_APP_ADMIN:     ROLE_ADMIN
        ROLE_USER_ADMIN:    ROLE_ADMIN
        ROLE_SERVICE_ADMIN: ROLE_ADMIN
        ROLE_SUPER_ADMIN:  [ROLE_SERVICE_ADMIN,ROLE_USER_ADMIN,ROLE_API,ROLE_WEBSERVICE]
        ROLE_SUPER_ADMIN_EXTENDED:  [ROLE_SUPER_ADMIN]
