我尝试通过将其配置为secury.yml来配置一个简单的安全管理区域。我使用了Symfony的例子:
security:
firewalls:
secured_area:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Admin Area"
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
providers:
in_memory:
users:
ryan: { password: ryanpass, roles: 'ROLE_USER' }
admin: { password: kitten, roles: 'ROLE_ADMIN' }
encoders:
Symfony\Component\Security\Core\User\User: plaintext
我有用户名/密码提示,但夫妻ryan:ryanpass和admin:小猫不起作用。有什么不对吗?
谢谢
答案 0 :(得分:1)
我认为你需要在你的案例中将提供者名称添加到http_basic部分:
http_basic:
realm: "Secured Admin Area"
provider: in_memory