security.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # To get started with security, check out the documentation:
  2. # https://symfony.com/doc/current/security.html
  3. security:
  4. encoders:
  5. AppBundle\Entity\User: sha512
  6. role_hierarchy:
  7. ROLE_ADMIN: [ROLE_USER, ROLE_MODERATEUR]
  8. ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
  9. # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
  10. providers:
  11. main:
  12. entity:
  13. class: AppBundle\Entity\User
  14. property: username
  15. firewalls:
  16. # disables authentication for assets and the profiler, adapt it according to your needs
  17. dev:
  18. pattern: ^/(_(profiler|wdt)|css|images|js)/
  19. security: false
  20. main_login:
  21. pattern: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=)
  22. anonymous: true
  23. logout_on_user_change: true
  24. main:
  25. anonymous: false
  26. pattern: ^/
  27. logout_on_user_change: true
  28. provider: main
  29. form_login:
  30. login_path: login
  31. check_path: login_check
  32. csrf_token_generator: security.csrf.token_manager
  33. logout:
  34. path: logout
  35. target: login
  36. remember_me:
  37. secret: "%secret%"
  38. switch_user: true
  39. # activate different ways to authenticate
  40. # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
  41. #http_basic: ~
  42. # https://symfony.com/doc/current/security/form_login_setup.html
  43. #form_login: ~
  44. access_control:
  45. - { path: ^/admin, roles: ROLE_ADMIN }
  46. - { path: ^/genre, roles: ROLE_MODERATEUR }