security.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: '%env(APP_SECRET)%'
  27. logout:
  28. path: app_logout
  29. target: app_login
  30. # activate different ways to authenticate
  31. # http_basic: true
  32. # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
  33. # form_login: true
  34. # https://symfony.com/doc/current/security/form_login_setup.html
  35. # Easy way to control access for large sections of your site
  36. # Note: Only the *first* access control that matches will be used
  37. access_control:
  38. - { path: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=|fichefilm/|$|liste-by/|liste-by_real/|recherche) , roles: IS_AUTHENTICATED_ANONYMOUSLY }
  39. - { path: ^/admin, roles: ROLE_ADMIN }
  40. - { path: ^/genre, roles: ROLE_MODERATEUR }
  41. - { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED }