security.yaml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. custom_authenticators:
  38. - App\Security\KeycloakAuthenticator
  39. role_hierarchy:
  40. # USER : utilisateur simple authentifié, suivi des réservations de ses parties, annulations, demandes de parties...
  41. ROLE_USER: ~
  42. # STAFF : utilisateur membre du staff, ex. MJ...
  43. ROLE_STAFF: [ROLE_USER]
  44. # MANAGER : utilisateur avec des droits étendus, gestion des parties et suivi des inscriptions...
  45. ROLE_MANAGER: [ROLE_STAFF]
  46. # ADMIN : utilisateur avec des droits étendus, gestion des parties, des utilisateurs, des gamemasters...
  47. ROLE_ADMIN: [ROLE_MANAGER]
  48. # Easy way to control access for large sections of your site
  49. # Note: Only the *first* access control that matches will be used
  50. access_control:
  51. - { path: ^/admin, roles: ROLE_ADMIN }
  52. - { path: ^/profile, roles: ROLE_USER }
  53. - { path: ^/manage, roles: ROLE_MANAGER }
  54. - { path: ^/prepare, roles: ROLE_STAFF }
  55. - { path: ^/checkin, roles: ROLE_STAFF }
  56. - { path: ^/login/keycloak, roles: PUBLIC_ACCESS }
  57. when@test:
  58. security:
  59. password_hashers:
  60. # By default, password hashers are resource intensive and take time. This is
  61. # important to generate secure password hashes. In tests however, secure hashes
  62. # are not important, waste resources and increase test times. The following
  63. # reduces the work factor to the lowest possible values.
  64. Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
  65. algorithm: auto
  66. cost: 4 # Lowest possible value for bcrypt
  67. time_cost: 3 # Lowest possible value for argon
  68. memory_cost: 10 # Lowest possible value for argon