security.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. security:
  2. enable_authenticator_manager: true
  3. password_hashers:
  4. App\Entity\LocalUser:
  5. algorithm: auto
  6. # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
  7. providers:
  8. local_user:
  9. chain:
  10. providers: [local_user_by_nickname, local_user_by_email]
  11. local_user_by_nickname:
  12. entity:
  13. class: 'App\Entity\LocalUser'
  14. property: 'nickname'
  15. local_user_by_email:
  16. entity:
  17. class: 'App\Entity\LocalUser'
  18. property: 'outgoing_email'
  19. firewalls:
  20. dev:
  21. pattern: ^/(_(profiler|wdt)|css|images|js)/
  22. security: false
  23. main:
  24. entry_point: App\Security\Authenticator
  25. guard:
  26. authenticators:
  27. - App\Security\Authenticator
  28. provider: local_user
  29. form_login:
  30. login_path: security_login
  31. check_path: security_login
  32. enable_csrf: true
  33. logout:
  34. path: security_logout
  35. # where to redirect after logout
  36. target: root
  37. remember_me:
  38. secret: '%kernel.secret%'
  39. secure: true
  40. httponly: '%remember_me_httponly%'
  41. samesite: '%remember_me_samesite%'
  42. token_provider: 'Symfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider'
  43. # activate different ways to authenticate
  44. # https://symfony.com/doc/current/security.html#firewalls-authentication
  45. # https://symfony.com/doc/current/security/impersonating_user.html
  46. # switch_user: true
  47. # Easy way to control access for large sections of your site
  48. # Note: Only the *first* access control that matches will be used
  49. access_control:
  50. - { path: ^/admin, roles: ROLE_OPERATOR }
  51. - { path: ^/settings, roles: ROLE_VISITOR }