security.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. security:
  2. encoders:
  3. FOS\UserBundle\Model\UserInterface:
  4. algorithm: sha512
  5. encode_as_base64: false
  6. iterations: 1
  7. providers:
  8. packagist:
  9. id: packagist.user_provider
  10. firewalls:
  11. main:
  12. pattern: .*
  13. form_login:
  14. provider: packagist
  15. login_path: /login
  16. use_forward: false
  17. check_path: /login_check
  18. failure_path: null
  19. remember_me:
  20. secret: '%remember_me.secret%'
  21. user_providers: packagist
  22. name: pauth
  23. always_remember_me: true
  24. lifetime: 31104000 # 1y
  25. logout_on_user_change: true
  26. logout: true
  27. anonymous: true
  28. oauth:
  29. resource_owners:
  30. github: '/login/check-github'
  31. login_path: /login
  32. failure_path: /login
  33. oauth_user_provider:
  34. service: packagist.user_provider
  35. two_factor:
  36. auth_form_path: 2fa_login
  37. check_path: 2fa_login_check
  38. csrf_token_generator: security.csrf.token_manager
  39. switch_user:
  40. provider: packagist
  41. access_control:
  42. # The WDT has to be allowed to anonymous users to avoid requiring the login with the AJAX request
  43. - { path: ^/_wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  44. - { path: ^/_profiler/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  45. # AsseticBundle paths used when using the controller for assets
  46. - { path: ^/js/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  47. - { path: ^/css/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  48. # URL of FOSUserBundle which need to be available to anonymous users
  49. - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  50. - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
  51. - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
  52. # This makes the logout route available during two-factor authentication, allows the user to cancel
  53. - { path: ^/logout, role: IS_AUTHENTICATED_ANONYMOUSLY }
  54. # This ensures that the form can only be accessed when two-factor authentication is in progress
  55. - { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS }
  56. # Secured part of the site
  57. # This config requires being logged for the whole site and having the admin role for the admin part.
  58. # Change these rules to adapt them to your needs
  59. - { path: ^/packages/submit$, role: ROLE_USER }
  60. - { path: ^/admin/, role: ROLE_ADMIN }
  61. role_hierarchy:
  62. ROLE_UPDATE_PACKAGES: ~
  63. ROLE_DELETE_PACKAGES: ~
  64. ROLE_EDIT_PACKAGES: ~
  65. ROLE_ANTISPAM: ~
  66. ROLE_SPAMMER: ~
  67. ROLE_DISABLE_2FA: ~
  68. ROLE_ADMIN: [ ROLE_USER, ROLE_UPDATE_PACKAGES, ROLE_EDIT_PACKAGES, ROLE_DELETE_PACKAGES, ROLE_ANTISPAM, ROLE_DISABLE_2FA ]
  69. ROLE_SUPERADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]