security:
  enable_authenticator_manager: true
  # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
  password_hashers:
    Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
    App\Entity\User:
      algorithm: auto

  role_hierarchy:
    ROLE_ADMIN: ROLE_USER
    #ROLE_SUPER_ADMIN: ROLE_ADMIN

  # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
  providers:
    # used to reload user from session & other features (e.g. switch_user)
    app_user_provider:
      entity:
        class: App\Entity\User
        property: email
  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false

    login:
      pattern: ^/api/login
      stateless: true
      json_login:
        check_path: /api/login_check # or api_login_check as defined in config/routes.yaml
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure

    main:
      pattern: ^/api
      stateless: true
      jwt: ~


      # 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
  access_control:
      - { path: ^/api/login, roles: PUBLIC_ACCESS}
      - { path: ^/api/admin, roles: ROLE_ADMIN }
      - { path: ^/api, roles: IS_AUTHENTICATED_FULLY}
