Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

security.token_storage is now private #3350

Closed
delboy1978uk opened this issue Mar 19, 2024 · 3 comments
Closed

security.token_storage is now private #3350

delboy1978uk opened this issue Mar 19, 2024 · 3 comments

Comments

@delboy1978uk
Copy link
Contributor

We have upgraded our site, currently on 7.1.x-dev, but ran into a problem in the AbstractEntityArticle AdminListController in the ArticleBundle, where security.token_storage is no longer in the container.
image
The service was made private in v6 of Symfony https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.0.md?plain=1#L459

I have since tried on a fresh Kuma install using 7.1 of both the cms-skeleton and the bundles.

When I access /nl/admin for the first time, I get the following error:
image

I tried to make the token storage public, both via yaml and via compiler pass, but neither successfully worked for me. I'm guessing anywhere that references it will need to use dependency injection instead?

@acrobat
Copy link
Member

acrobat commented Mar 23, 2024

I can't reproduce this problem. When I debug a local demo app and set a breakpoint in the AbstractArticleEntityAdminListController, I can retreive the token storage service and get the user object

image

Which versions of symfony and the security bundle have you installed? Do you have any service overrides for the AbstractArticleEntityAdminListController? Because the controller uses a service locator it should not matter if the service is private.

@delboy1978uk
Copy link
Contributor Author

As I mentioned, I also get this error on a fresh Kuma install using the 7.1 branches of the skeleton and the bundles, so there isn't anything overriding the config. The version of Symfony installed is 6.3.12, as is the security bundle, and it was running on PHP 8.1.

@jverdeyen
Copy link
Contributor

@acrobat You can close this issue, since this is resolved on our side.

We've created a custom AdminlistConfiguratorBuilder which is used to create dynamic AdminlistConfiguration/Controller services in a CompilerPass. But we needed to add the service subscriber tag to the controller as automagic tagging from the AbstractController class seems to be ignored (or created later than the automagic tagging)

$definition->addTag('container.service_subscriber');

Thanks!

@acrobat acrobat closed this as completed May 6, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants