security.yaml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. security:
  2. #enable_authenticator_manager: true
  3. password_hashers:
  4. App\Entity\User:
  5. algorithm: auto
  6. # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
  7. role_hierarchy:
  8. ROLE_ADMIN: [ROLE_USER, ROLE_MODERATEUR]
  9. ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
  10. # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
  11. providers:
  12. app_user_provider:
  13. entity:
  14. class: App\Entity\User
  15. property: username
  16. firewalls:
  17. dev:
  18. pattern: ^/(_(profiler|wdt)|css|images|js)/
  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. logout:
  29. path: app_logout
  30. target: app_login
  31. custom_authenticator: App\Security\LoginFormAuthenticator
  32. #lazy: true
  33. #provider: users_in_memory
  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: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=|attente$|fichefilm/|$|liste-by/|liste-by_real/|recherche|prochaines-sorties$|p/about$) , roles: PUBLIC_ACCESS }
  42. - { path: ^/admin, roles: ROLE_ADMIN }
  43. - { path: ^/genre, roles: ROLE_MODERATEUR }
  44. - { path: ^/p/edit, roles: ROLE_ADMIN }
  45. - { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED }