security.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. api_apps:
  24. pattern: ^/api/v1/apps$
  25. security: false
  26. api_token:
  27. pattern: ^/oauth/token$
  28. security: false
  29. api:
  30. provider: local_user
  31. pattern: ^/api/
  32. security: true
  33. stateless: true
  34. main:
  35. entry_point: App\Security\Authenticator
  36. guard:
  37. authenticators:
  38. - App\Security\Authenticator
  39. provider: local_user
  40. form_login:
  41. login_path: security_login
  42. check_path: security_login
  43. enable_csrf: true
  44. logout:
  45. path: security_logout
  46. # where to redirect after logout
  47. target: root
  48. remember_me:
  49. secret: '%kernel.secret%'
  50. secure: true
  51. httponly: '%remember_me_httponly%'
  52. samesite: '%remember_me_samesite%'
  53. token_provider: 'Symfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider'
  54. # activate different ways to authenticate
  55. # https://symfony.com/doc/current/security.html#firewalls-authentication
  56. # https://symfony.com/doc/current/security/impersonating_user.html
  57. # switch_user: true
  58. # Easy way to control access for large sections of your site
  59. # Note: Only the *first* access control that matches will be used
  60. access_control:
  61. - { path: ^/admin, roles: ROLE_ADMIN }
  62. - { path: ^/settings, roles: ROLE_USER }
  63. - { path: ^/authorize, roles: IS_AUTHENTICATED_REMEMBERED }