Symfony2 plaintext users don't work

2019-07-16 11:37发布

I tried to configure a simple secured admin area by configuring it into secury.yml. I used the example of 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

I have the username / password prompt, but the couples ryan:ryanpass and admin:kitten doesn't work. Is there something wrong ?

Thank you

1条回答
做自己的国王
2楼-- · 2019-07-16 11:51

I think you need to add the provider name to the http_basic section in your case:

http_basic:
    realm: "Secured Admin Area"
    provider: in_memory
查看更多
登录 后发表回答