security.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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: email
  12. firewalls:
  13. dev:
  14. pattern: ^/(_(profiler|wdt)|css|images|js)/
  15. security: false
  16. main:
  17. pattern: ^/
  18. lazy: true
  19. provider: app_user_provider
  20. login_link:
  21. check_route: login_check
  22. signature_properties: ['id', 'email']
  23. entry_point: App\Security\CustomEntryPoint
  24. logout:
  25. path: app_logout
  26. target: /login
  27. remember_me:
  28. secret: '%kernel.secret%'
  29. path: /
  30. # activate different ways to authenticate
  31. # https://symfony.com/doc/current/security.html#the-firewall
  32. # https://symfony.com/doc/current/security/impersonating_user.html
  33. # switch_user: true
  34. # Easy way to control access for large sections of your site
  35. # Note: Only the *first* access control that matches will be used
  36. access_control:
  37. # - { path: ^/admin, roles: ROLE_ADMIN }
  38. # - { path: ^/profile, roles: ROLE_USER }
  39. - { path: ^/login, roles: PUBLIC_ACCESS }
  40. - { path: ^/sent, roles: PUBLIC_ACCESS }
  41. - { path: ^/, roles: ROLE_USER }
  42. when@test:
  43. security:
  44. password_hashers:
  45. # By default, password hashers are resource intensive and take time. This is
  46. # important to generate secure password hashes. In tests however, secure hashes
  47. # are not important, waste resources and increase test times. The following
  48. # reduces the work factor to the lowest possible values.
  49. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  50. algorithm: auto
  51. cost: 4 # Lowest possible value for bcrypt
  52. time_cost: 3 # Lowest possible value for argon
  53. memory_cost: 10 # Lowest possible value for argon