security:
  # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
  providers:
    jwt:
      lexik_jwt: ~
    # used to reload user from session & other features (e.g. switch_user)
    app_user_provider:
      entity:
        class: App\Entity\User
        property: email
    # used to reload user from session & other features (e.g. switch_user)
  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    api:
      pattern:   ^/api/
      stateless: true
      provider: jwt
      guard:
        authenticators:
          - lexik_jwt_authentication.jwt_token_authenticator
    main:
      pattern:   ^/
      anonymous: ~
      provider: app_user_provider
      guard:
        authenticators:
          - App\Security\AzureAuthenticator
      logout:
        path: logout
        target: app_page

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

      # 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
  access_control:
    # - { path: ^/admin, roles: ROLE_ADMIN }
    - { path: ^/auth/callback, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/web, roles: ROLE_USER }
    - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
