security.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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)
  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. logout:
  33. path: logout
  34. target: login
  35. remember_me:
  36. secret: "%secret%"
  37. switch_user: true
  38. # activate different ways to authenticate
  39. # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
  40. #http_basic: ~
  41. # https://symfony.com/doc/current/security/form_login_setup.html
  42. #form_login: ~
  43. access_control:
  44. - { path: ^/admin, roles: ROLE_ADMIN }