In_memory与自定义身份验证提供程序

时间:2014-02-19 16:10:08

标签: security symfony

我已经开发了自己的身份验证提供程序作为创始人here

我曾经与in_memory系统连接,但现在我无法再使用它了。我错过了什么吗?

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        Acme\SecurityBundle\User\WebServiceUser: plaintext
    firewalls:
        login:
            pattern:  ^/login$
            security: false
        secured_area:
            pattern:    ^/
            anonymous: ~
            webservice-login:
                login_path:  /login
                check_path:  /login_check
                provider: acme_provider
            logout: ~
    providers:
        multiples:
            chain:
                providers: [in_memory, acme_provider]
        acme_provider:
            id: acme_demo_user_provider
        in_memory:
            memory:
                users:
                    - { name: admin, password: pwd, roles: [ 'ROLE_ADMIN' ] }

1 个答案:

答案 0 :(得分:2)

您已指定webservice-login使用acme_provider代替您的multiples提供商。

试试这个:

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        Acme\SecurityBundle\User\WebServiceUser: plaintext
    firewalls:
        login:
            pattern:  ^/login$
            security: false
        secured_area:
            pattern:    ^/
            anonymous: ~
            webservice-login:
                login_path:  /login
                check_path:  /login_check
                provider: multiples
            logout: ~
    providers:
        multiples:
            chain:
                providers: [in_memory, acme_provider]
        acme_provider:
            id: acme_demo_user_provider
        in_memory:
            memory:
                users:
                    - { name: admin, password: pwd, roles: [ 'ROLE_ADMIN' ] }

表单将根据in_memory或acme_provider

对用户进行身份验证