security.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. secure: '%force_ssl%'
  25. lifetime: 31104000 # 1y
  26. logout_on_user_change: true
  27. logout: true
  28. anonymous: true
  29. oauth:
  30. resource_owners:
  31. github: '/login/check-github'
  32. login_path: /login
  33. failure_path: /login
  34. oauth_user_provider:
  35. service: packagist.user_provider
  36. two_factor:
  37. auth_form_path: 2fa_login
  38. check_path: 2fa_login_check
  39. csrf_token_generator: security.csrf.token_manager
  40. switch_user:
  41. provider: packagist
  42. access_control:
  43. # The WDT has to be allowed to anonymous users to avoid requiring the login with the AJAX request
  44. - { path: ^/_wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  45. - { path: ^/_profiler/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  46. # AsseticBundle paths used when using the controller for assets
  47. - { path: ^/js/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  48. - { path: ^/css/, role: IS_AUTHENTICATED_ANONYMOUSLY }
  49. # URL of FOSUserBundle which need to be available to anonymous users
  50. - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
  51. - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
  52. - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
  53. # This makes the logout route available during two-factor authentication, allows the user to cancel
  54. - { path: ^/logout, role: IS_AUTHENTICATED_ANONYMOUSLY }
  55. # This ensures that the form can only be accessed when two-factor authentication is in progress
  56. - { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS }
  57. # Secured part of the site
  58. # This config requires being logged for the whole site and having the admin role for the admin part.
  59. # Change these rules to adapt them to your needs
  60. - { path: ^/packages/submit$, role: ROLE_USER }
  61. - { path: ^/admin/, role: ROLE_ADMIN }
  62. role_hierarchy:
  63. ROLE_UPDATE_PACKAGES: ~
  64. ROLE_DELETE_PACKAGES: ~
  65. ROLE_EDIT_PACKAGES: ~
  66. ROLE_ANTISPAM: ~
  67. ROLE_SPAMMER: ~
  68. ROLE_DISABLE_2FA: ~
  69. ROLE_ADMIN: [ ROLE_USER, ROLE_UPDATE_PACKAGES, ROLE_EDIT_PACKAGES, ROLE_DELETE_PACKAGES, ROLE_ANTISPAM, ROLE_DISABLE_2FA ]
  70. ROLE_SUPERADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]