security.yaml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. # used to reload user from session & other features (e.g. switch_user)
  13. firewalls:
  14. dev:
  15. pattern: ^/(_(profiler|wdt)|css|images|js)/
  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. user_checker: App\Security\UserChecker
  25. remember_me:
  26. # https://symfony.com/doc/current/security/remember_me.html
  27. secret: '%kernel.secret%'
  28. lifetime: 604800 # 7 days in seconds
  29. logout:
  30. path: app_logout
  31. # where to redirect after logout
  32. # target: app_any_route
  33. # activate different ways to authenticate
  34. # https://symfony.com/doc/current/security.html#the-firewall
  35. # https://symfony.com/doc/current/security/impersonating_user.html
  36. # switch_user: true
  37. role_hierarchy:
  38. # USER : utilisateur simple authentifié, suivi des réservations de ses parties, annulations, demandes de parties...
  39. ROLE_USER: ~
  40. # STAFF : utilisateur avec des droits étendus, gestion des parties, des utilisateurs, des gamemasters...
  41. ROLE_STAFF: [ROLE_USER]
  42. # MANAGER : utilisateur avec des droits étendus, gestion des parties, des utilisateurs, des gamemasters...
  43. ROLE_MANAGER: [ROLE_STAFF]
  44. # ADMIN : utilisateur avec des droits étendus, gestion des parties, des utilisateurs, des gamemasters...
  45. ROLE_ADMIN: [ROLE_MANAGER]
  46. # Easy way to control access for large sections of your site
  47. # Note: Only the *first* access control that matches will be used
  48. access_control:
  49. - { path: ^/admin, roles: ROLE_ADMIN }
  50. - { path: ^/profile, roles: ROLE_USER }
  51. when@test:
  52. security:
  53. password_hashers:
  54. # By default, password hashers are resource intensive and take time. This is
  55. # important to generate secure password hashes. In tests however, secure hashes
  56. # are not important, waste resources and increase test times. The following
  57. # reduces the work factor to the lowest possible values.
  58. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  59. algorithm: auto
  60. cost: 4 # Lowest possible value for bcrypt
  61. time_cost: 3 # Lowest possible value for argon
  62. memory_cost: 10 # Lowest possible value for argon