security.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. security:
  2. #enable_authenticator_manager: true
  3. password_hashers:
  4. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
  5. # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
  6. role_hierarchy:
  7. ROLE_ADMIN: [ROLE_USER, ROLE_MODERATEUR]
  8. ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
  9. # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
  10. providers:
  11. app_user_provider:
  12. entity:
  13. class: App\Entity\User
  14. property: username
  15. firewalls:
  16. dev:
  17. # Ensure dev tools and static assets are always allowed
  18. pattern: ^/(_profiler|_wdt|assets|build)/
  19. security: false
  20. main:
  21. user_checker: App\Security\UserChecker
  22. #guard:
  23. # authenticators:
  24. # - App\Security\LoginFormAuthenticator
  25. remember_me:
  26. secret: '%kernel.secret%'
  27. samesite: 'lax'
  28. form_login:
  29. login_path: app_login
  30. check_path: app_login
  31. enable_csrf: true
  32. logout:
  33. path: app_logout
  34. target: app_login
  35. #custom_authenticator: App\Security\LoginFormAuthenticator
  36. #lazy: true
  37. #provider: users_in_memory
  38. # Activate different ways to authenticate:
  39. # https://symfony.com/doc/current/security.html#the-firewall
  40. # https://symfony.com/doc/current/security/impersonating_user.html
  41. # switch_user: true
  42. # Note: Only the *first* matching rule is applied
  43. access_control:
  44. - { path: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=|attente$|fichefilm/|$|liste-by/|liste-by_real/|recherche|prochaines-sorties$|p/about$) , roles: PUBLIC_ACCESS }
  45. - { path: ^/admin, roles: ROLE_ADMIN }
  46. - { path: ^/genre, roles: ROLE_MODERATEUR }
  47. - { path: ^/p/edit, roles: ROLE_ADMIN }
  48. - { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED }
  49. # - { path: ^/admin, roles: ROLE_ADMIN }
  50. # - { path: ^/profile, roles: ROLE_USER }
  51. when@test:
  52. security:
  53. password_hashers:
  54. # Password hashers are resource-intensive by design to ensure security.
  55. # In tests, it's safe to reduce their cost to improve performance.
  56. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  57. algorithm: auto
  58. cost: 4 # Lowest possible value for bcrypt
  59. time_cost: 3 # Lowest possible value for argon
  60. memory_cost: 10 # Lowest possible value for argon