security.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. security:
  2. # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
  3. password_hashers:
  4. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
  5. # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
  6. providers:
  7. # used to reload user from session & other features (e.g. switch_user)
  8. app_user_provider:
  9. entity:
  10. class: App\Entity\User
  11. property: username
  12. firewalls:
  13. dev:
  14. pattern: ^/(_(profiler|wdt)|css|images|js)/
  15. security: false
  16. main:
  17. lazy: true
  18. provider: app_user_provider
  19. form_login:
  20. login_path: app_login
  21. check_path: app_login
  22. enable_csrf: true
  23. logout:
  24. path: app_logout
  25. # where to redirect after logout
  26. # target: app_any_route
  27. # activate different ways to authenticate
  28. # https://symfony.com/doc/current/security.html#the-firewall
  29. # https://symfony.com/doc/current/security/impersonating_user.html
  30. # switch_user: true
  31. # Easy way to control access for large sections of your site
  32. # Note: Only the *first* access control that matches will be used
  33. access_control:
  34. # - { path: ^/admin, roles: ROLE_ADMIN }
  35. # - { path: ^/profile, roles: ROLE_USER }
  36. when@test:
  37. security:
  38. password_hashers:
  39. # By default, password hashers are resource intensive and take time. This is
  40. # important to generate secure password hashes. In tests however, secure hashes
  41. # are not important, waste resources and increase test times. The following
  42. # reduces the work factor to the lowest possible values.
  43. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  44. algorithm: auto
  45. cost: 4 # Lowest possible value for bcrypt
  46. time_cost: 3 # Lowest possible value for argon
  47. memory_cost: 10 # Lowest possible value for argon