I'm facing a good challenge in one of my projects.
I need to inject the User Provider defined for a firewall in a service of a third party bundle that I'm developing. I cannot define it explicitly in my service, because I want to achieve that, when the service is called from a different firewall or the user changes the provider in security.yaml
, my service adapts to use the right provider.
What I've been able to accomplish is to get just the name of the provider by injecting the RequestStack
and the FirewallMap
and getting the FirewallConfig
using the current request, but nothing more, just the name.
I wonder if there's a way of doing this. There's nothing in the docs with regards to this. But I'm sure there must be a way, since the authentication listeners in Security Bundle do the same.
I'm reading your clever responses! :)