Outils pour utilisateurs

Outils du site


pele_mele:stack_exchange:stack_overflow:47312136

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
pele_mele:stack_exchange:stack_overflow:47312136 [2024/11/23 04:02] – supprimée - modification externe (Date inconnue) 127.0.0.1pele_mele:stack_exchange:stack_overflow:47312136 [2024/11/23 04:02] (Version actuelle) – ↷ Nom de la page changé de pele_mele:stack_exchange:stack_overflow:stackoverflow-47312136 à pele_mele:stack_exchange:stack_overflow:47312136 alexis
Ligne 1: Ligne 1:
 +====== 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:
 +
 +<code yaml>
 +security:
 +    providers:
 +        page:
 +            memory:
 +                users:
 +                    "%env(PAGE_USERNAME)%": { password: '%env(PAGE_PASSWORD)%' }
 +</code>
 +
 +It was working recently but now I've got an exception every time I am using the console. Here is the exception:
 +
 +<code>
 +[Symfony\Component\DependencyInjection\Exception\EnvParameterException]                                                                
 +A service name ("security.user.provider.concrete.page_%env(PAGE_USERNAME)%") cannot contain dynamic values.
 +</code>
 +
 +After some research, it turns out that there was a [[https://github.com/symfony/symfony/pull/24673|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?
 +
 +<WRAP info>
 +[[https://stackoverflow.com/questions/47312136/how-to-use-a-variable-as-user-name-in-a-sf-memory-provider|symfony - How to use a variable as user name in a SF memory provider? - Stack Overflow]]
 +</WRAP>