security.yaml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. # Ensure dev tools and static assets are always allowed
  15. pattern: ^/(_profiler|_wdt|assets|build)/
  16. security: false
  17. main:
  18. lazy: true
  19. provider: app_user_provider
  20. form_login:
  21. login_path: app_login
  22. check_path: app_login
  23. enable_csrf: true
  24. logout:
  25. path: app_logout
  26. # where to redirect after logout
  27. # target: app_any_route
  28. remember_me:
  29. secret: '%kernel.secret%' # required
  30. #lifetime: 604800 # 1 week in seconds
  31. # by default, the feature is enabled by checking a
  32. # checkbox in the login form (see below), uncomment the
  33. # following line to always enable it.
  34. #always_remember_me: true
  35. # Activate different ways to authenticate:
  36. # https://symfony.com/doc/current/security.html#the-firewall
  37. # https://symfony.com/doc/current/security/impersonating_user.html
  38. # switch_user: true
  39. # Note: Only the *first* matching rule is applied
  40. access_control:
  41. # - { path: ^/admin, roles: ROLE_ADMIN }
  42. # - { path: ^/profile, roles: ROLE_USER }
  43. role_hierarchy:
  44. ROLE_ADMIN: ROLE_MODERATOR, ROLE_CONTACT
  45. ROLE_CONTACT: ROLE_AUTHOR
  46. when@test:
  47. security:
  48. password_hashers:
  49. # Password hashers are resource-intensive by design to ensure security.
  50. # In tests, it's safe to reduce their cost to improve performance.
  51. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  52. algorithm: auto
  53. cost: 4 # Lowest possible value for bcrypt
  54. time_cost: 3 # Lowest possible value for argon
  55. memory_cost: 10 # Lowest possible value for argon