Combining in_memory and custom provider

I have a custom provider (call it MyUserProvider

) which is used to create a custom user ( MyUser

or MyOtherUser

depending on the user, but never mind). Typically this custom ISP is used with SSO / CAS authentication (via BeSimpleSSOBundle).

However, in a development environment, I cannot use SSO / CAS authentication and I have to use a different authentication. I thought the authentication in_memory

would be fine. But I still need to use MyUserProvider

.

The problem is, if security_dev.yml

I only mention MyUserProvider in my file , the user will not be authenticated ( security.INFO: Authentication request failed for user "kelux": The presented password is invalid

). What for? Because the class MyUser

doesn't know about the user's password (it's delegated to SSO / CAS). So I want to use in_memory

.

But I don't want to use only in_memory

. If I do this, then the User to be used will be the default Symfony\Component\Security\Core\User\User

, which is not what I want.

And I don't want to link them, as I want both of them not to be this or that.

Here is security_dev.yml

(as in the first case I described): security: encoders: Alecsia \ AnnotationBundle \ Entity \ MyUser: plaintext

    providers:
       entity:
            id: alecsia.MyUserProvider
    firewalls:
             secured_area:
                 pattern:    ^/
                 http_basic:
                     realm: "Secured Demo Area"

      

And the service is alecsia.MyUserProvider

described as (it relies on three services to know what type of user it is):

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

      

So how can I provide authentication in_memory

(dev environment only) when using MyUserProvider?

Thank you for your help!

+3


source to share





All Articles