security:
  encoders:
    #Symfony\Component\Security\Core\User\User: 'auto'
    App\Entity\User:
      algorithm: bcrypt

  providers:
    oauth:
      id: knpu.oauth2.user_provider
    app_user_provider:
      entity:
        class: App\Entity\User
        property: email

    app_admin_provider:
          entity:
            class: App\Entity\User
            property: email

  firewalls:
    admin:
      anonymous: ~
      pattern:    ^/admin
      provider: app_admin_provider
      form_login:
        login_path: app_admin_login
        check_path: app_admin_login
        default_target_path: admin_survey_tests_index
      logout:
        path:   app_admin_logout
        target: app_admin_login

    main:
      anonymous: ~
      pattern:    ^/
      provider: app_user_provider
      form_login:
        login_path: app_login
        check_path: app_login
        default_target_path: user_accueil_index
      logout:
        path:   app_logout
        target: app_login
      guard:
        authenticators:
          - App\Security\SecurityAuthenticator
          - App\Security\FacebookAuthenticator
        entry_point: App\Security\SecurityAuthenticator

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


  access_control:
    - { path: ^/admin/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
    - { path: ^/admin/, roles: ROLE_ADMIN, requires_channel: https}
    - { path: ^/home/, roles: ROLE_USER, requires_channel: https }
    - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
    #- { path: ^/inscription, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    #- { path: ^/./, roles: IS_AUTHENTICATED_ANONYMOUSLY }



