我需要使用 Symfony 4.4 中的 http://host/import/myfile 等基本身份驗證來保護 POST 請求
在 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
uj5u.com熱心網友回復:
這是答案,希望對您有所幫助!
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/438757.html
上一篇:kubectl版本錯誤:exec插件配置為使用API版本client.authentication.k8s.io/v1alpha1
