0

我正在定义一个新的身份验证提供程序,并且我需要访问密码编码器工厂,因此我将我的提供程序定义为一项服务并要求注入编码器。这是我的服务定义:

services:
    wsse.security.authentication.provider:
        class:  Fdi\CliperestBundle\Security\Authentication\Provider\WsseProvider
        arguments: [@security.encoder_factory,'', %kernel.cache_dir%/security/nonces]

所以我期待我的提供者构造函数会得到一个类型的对象Symfony\Component\Security\Core\Encoder\EncoderFactory。但我得到了一个Symfony\Component\Security\Core\User\ChainUserProvider代替!

有谁知道我为什么要得到这个对象以及我能做些什么来得到 EncoderFactory 呢?顺便说一句,我正在使用 FOSUserBundle,不知道它是否与此有关

4

1 回答 1

1

OK, I found the answer. Since this service is defined as an authentication provider, the first argument to the constructor has to be and user provider which is inserted by the security component. Changing the order of the arguments did the trick:

services:
    wsse.security.authentication.provider:
        class:  Fdi\CliperestBundle\Security\Authentication\Provider\WsseProvider
        arguments: ['', %kernel.cache_dir%/security/nonces, @security.encoder_factory]
于 2013-04-05T04:00:09.863 回答