security.yaml 3.0 KB

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