security.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. remember_me:
  28. secret: '%kernel.secret%' # required
  29. #lifetime: 604800 # 1 week in seconds
  30. # by default, the feature is enabled by checking a
  31. # checkbox in the login form (see below), uncomment the
  32. # following line to always enable it.
  33. #always_remember_me: true
  34. # activate different ways to authenticate
  35. # https://symfony.com/doc/current/security.html#the-firewall
  36. # https://symfony.com/doc/current/security/impersonating_user.html
  37. # switch_user: true
  38. # Easy way to control access for large sections of your site
  39. # Note: Only the *first* access control that matches will be used
  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. # By default, password hashers are resource intensive and take time. This is
  50. # important to generate secure password hashes. In tests however, secure hashes
  51. # are not important, waste resources and increase test times. The following
  52. # reduces the work factor to the lowest possible values.
  53. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  54. algorithm: auto
  55. cost: 4 # Lowest possible value for bcrypt
  56. time_cost: 3 # Lowest possible value for argon
  57. memory_cost: 10 # Lowest possible value for argon