security.yaml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. role_hierarchy:
  37. ROLE_ADMIN: ROLE_MODERATOR, ROLE_CONTACT
  38. ROLE_CONTACT: ROLE_AUTHOR
  39. when@test:
  40. security:
  41. password_hashers:
  42. # By default, password hashers are resource intensive and take time. This is
  43. # important to generate secure password hashes. In tests however, secure hashes
  44. # are not important, waste resources and increase test times. The following
  45. # reduces the work factor to the lowest possible values.
  46. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  47. algorithm: auto
  48. cost: 4 # Lowest possible value for bcrypt
  49. time_cost: 3 # Lowest possible value for argon
  50. memory_cost: 10 # Lowest possible value for argon