Symfony 结合内存和自定义用户提供程序

Symfony 结合内存和自定义用户提供程序,symfony,authentication,in-memory,Symfony,Authentication,In Memory,我有一个自定义用户提供程序(我们称之为MyUserProvider),用于创建自定义用户(MyUser或MyOtherUser,具体取决于用户,但没关系)。通常,此用户提供程序与SSO/CAS身份验证一起使用(通过BeSimpleSSOBundle) 然而,在开发环境中,我不能使用SSO/CAS身份验证,我必须使用其他身份验证。我以为内存中的身份验证就可以了。但是我仍然需要使用MyUserProvider 问题是,如果在我的security\u dev.yml文件中我只提到了MyUserProv

我有一个自定义用户提供程序(我们称之为
MyUserProvider
),用于创建自定义用户(
MyUser
MyOtherUser
,具体取决于用户,但没关系)。通常,此用户提供程序与SSO/CAS身份验证一起使用(通过BeSimpleSSOBundle)

然而,在开发环境中,我不能使用SSO/CAS身份验证,我必须使用其他身份验证。我以为
内存中的
身份验证就可以了。但是我仍然需要使用
MyUserProvider

问题是,如果在我的
security\u dev.yml
文件中我只提到了MyUserProvider,那么该用户将无法通过身份验证(
security.INFO:Authentication request failed for user“kelux”:提供的密码无效
)。为什么?因为
MyUser
类不知道用户的密码(它被委托给SSO/CAS)。这就是为什么我想使用内存中的

但是我不想单独使用内存中的
。如果我这样做,那么将使用的用户是默认的
Symfony\Component\Security\Core\User\User
,这不是我想要的

我不想把它们都拴起来,因为我想要它们,而不是一个或另一个

以下是
安全性_dev.yml
(如我所描述的第一种情况所示): 安全: 编码器: Alecsia\AnnotationBundle\Entity\MyUser:纯文本

    providers:
       entity:
            id: alecsia.MyUserProvider
    firewalls:
             secured_area:
                 pattern:    ^/
                 http_basic:
                     realm: "Secured Demo Area"
并且
alecsia.MyUserProvider
服务被描述为原样(它依赖于三个服务来知道它是哪种类型的用户):

那么,在使用MyUserProvider时,如何在内存中提供
身份验证(仅适用于开发环境)

谢谢你的帮助

services:
    alecsia.Lille1UserProvider:
        class: Alecsia\AnnotationBundle\Security\User\MyUserProvider
        arguments: [@alecsia.MyService,@alecsia.MyOtherService,@alecsia.MyLastService]