security:
  enable_authenticator_manager: true
  # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
  password_hashers:
    App\Entity\User:
      algorithm: auto
    # auto hasher with custom options for all PasswordAuthenticatedUserInterface instances
    Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
      algorithm: "auto"
      cost: 15
  # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
  providers:
    app_user_provider:
      entity:
        class: App\Entity\User
        property: username
  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    main:
      lazy: true
      provider: app_user_provider
      custom_authenticator: App\Security\LoginFormAuthenticator
      logout:
        path: app_logout

      # activate different ways to authenticate
      # https://symfony.com/doc/current/security.html#the-firewall

      # https://symfony.com/doc/current/security/impersonating_user.html
      # switch_user: true

  # Easy way to control access for large sections of your site
  # Note: Only the *first* access control that matches will be used
  role_hierarchy:
    ROLE_SOCIETE: ROLE_USER
    ROLE_INTERMITTENT: ROLE_USER
    ROLE_ADMIN: [ROLE_INTERMITTENT, ROLE_SOCIETE]
  access_control:
    - { path: ^/efconnect, role: ROLE_USER }
    - { path: ^/elfinder, role: ROLE_USER }
    - { path: ^/admin, roles: ROLE_ADMIN }
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/validation, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - {
        path: ^/reinitialiser-mot-de-passe,
        roles: IS_AUTHENTICATED_ANONYMOUSLY,
      }
    - { path: ^/mot-de-passe-oublie, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/, roles: ROLE_USER }
