security.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. form_login:
  29. login_path: app_login
  30. check_path: app_login
  31. enable_csrf: true
  32. logout:
  33. path: app_logout
  34. target: app_login
  35. #custom_authenticator: App\Security\LoginFormAuthenticator
  36. #lazy: true
  37. #provider: users_in_memory
  38. # activate different ways to authenticate
  39. # https://symfony.com/doc/current/security.html#the-firewall
  40. # https://symfony.com/doc/current/security/impersonating_user.html
  41. # switch_user: true
  42. # Easy way to control access for large sections of your site
  43. # Note: Only the *first* access control that matches will be used
  44. access_control:
  45. - { path: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=|attente$|fichefilm/|$|liste-by/|liste-by_real/|recherche|prochaines-sorties$|p/about$) , roles: PUBLIC_ACCESS }
  46. - { path: ^/admin, roles: ROLE_ADMIN }
  47. - { path: ^/genre, roles: ROLE_MODERATEUR }
  48. - { path: ^/p/edit, roles: ROLE_ADMIN }
  49. - { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED }