如何在 symfony 4.4 中使用基本身份验证限制 post 请求
How to Restrict a post Request with basic auth in symfony 4.4
我需要使用基本身份验证保护POST请求
就像 Symfony 4.4 中的 http:///host/import/myfile
在 security.yaml 中,我试过这个但它不起作用
providers:
authorized_users:
http_basic:
- identifier: '%env(HTTP_BASIC_AUTH_USERNAME)%'
- password: '%env(HTTP_BASIC_AUTH_PASSWORD)%'
firewalls:
secured_area:
methods: [POST]
pattern: ^/import/myfile
provider: authorized_users
答案在此,希望对您有所帮助!
providers:
authorized_users:
memory:
users:
"%env(HTTP_BASIC_AUTH_USERNAME)%":
password: '%env(HTTP_BASIC_AUTH_PASSWORD)%'
firewalls:
secured_area:
pattern: ^/import/myfile
stateless: true
http_basic:
provider: authorized_users
我需要使用基本身份验证保护POST请求 就像 Symfony 4.4 中的 http:///host/import/myfile
在 security.yaml 中,我试过这个但它不起作用
providers:
authorized_users:
http_basic:
- identifier: '%env(HTTP_BASIC_AUTH_USERNAME)%'
- password: '%env(HTTP_BASIC_AUTH_PASSWORD)%'
firewalls:
secured_area:
methods: [POST]
pattern: ^/import/myfile
provider: authorized_users
答案在此,希望对您有所帮助!
providers:
authorized_users:
memory:
users:
"%env(HTTP_BASIC_AUTH_USERNAME)%":
password: '%env(HTTP_BASIC_AUTH_PASSWORD)%'
firewalls:
secured_area:
pattern: ^/import/myfile
stateless: true
http_basic:
provider: authorized_users