Outils pour utilisateurs

Outils du site


pele_mele:stack_exchange:stackoverflow-47312136

How to use a variable as user name in a SF memory provider?

I was trying to use a variable provided by my .env file as the username in the memory provider in my security.yml file. My configuration looks like that:

security:
    providers:
        page:
            memory:
                users:
                    "%env(PAGE_USERNAME)%": { password: '%env(PAGE_PASSWORD)%' }

It was working recently but now I've got an exception every time I am using the console. Here is the exception:

[Symfony\Component\DependencyInjection\Exception\EnvParameterException]                                                                
A service name ("security.user.provider.concrete.page_%env(PAGE_USERNAME)%") cannot contain dynamic values.

After some research, it turns out that there was a modification in Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass recently which changed that behavior.

Is there another way of doing what I want to do? Is this considered as a bug?

pele_mele/stack_exchange/stackoverflow-47312136.txt · Dernière modification : 2020/11/18 09:16 de alexis