Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mark the exik_jwt_authentication.encoder.default service as autowire default for JWTEncoderInterface #256

Closed
weaverryan opened this issue Oct 20, 2016 · 2 comments

Comments

@weaverryan
Copy link

First, congrats on 2.0! I'm looking forward to checkout out all the changes!

On KnpU, since we use this bundle, I just had one user mention a small change in 2.0 that I think we can make smoother. Specifically, we use autowiring on a service that has JWTEncoderInterface as an argument. With 2.0, this gives the following exception:

Unable to autowire argument of type "Lexik\Bundle\JWTAuthenticationBundle\Encoder\JWTEncoderInterface" for the service "app.security.jwt_token_authenticator". Multiple services exist for this interface (lexik_jwt_authentication.encoder.default, lexik_jwt_authentication.encoder.lcobucci).

Could we mark the lexik_jwt_authentication.encoder.default as the correct autowiring service for this interface? We would just need an autowiring_types key added to that service (http://symfony.com/doc/current/components/dependency_injection/autowiring.html) - this is done in other places, like MonologBundle to mark @logger as the default LoggerInterface service.

Thanks!

@chalasr
Copy link
Collaborator

chalasr commented Oct 20, 2016

@weaverryan Really, thank you very much for the help you given on this major version.
I'm glad to see you upgrading and I hope it will not be too much work.

About the autowiring types, it's indeed something good to have that I totally missed 👍
As you spotted the change has been made. I just tagged a v2.0.1 so you should be able to get it.

I have to remind you that this bundle now has a built-in Guard authenticator, greatly inspired from the one of your KnpUniversity lesson and presentation (I'm pretty sure it is the very same that the DIC was not able to autowire :))

Feedbacks from you and your collaborators will be greatly appreciated.

Closing as fixed in #257. Thank you!

@chalasr chalasr closed this as completed Oct 20, 2016
@weaverryan
Copy link
Author

Wow, that was so fast! And I already replied to the user (who just posted the comment this morning!). You rock :).

I have an issue internally to pull down 2.0.1 with our tutorial and make sure things are smooth - that'll be my chance to really test out the new version. I'm also excited to look at the authenticator - I will probably at least add a note so that users know that this is an option (versus building their own, which is a nice exercise, but not necessarily the best actual solution).

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants