Closed aklinkert closed 1 year ago
Thank you for opening this issue, @aklinkert.
It looks like the specific request in this issue is to accept multiple HTTPS URLs for separate JWKS as arguments. Let me know if I read that incorrectly.
I currently do not have plans to change keyfunc.Get
to accept multiple HTTPS URLs for separate JWKS. Perhaps adding a new function that can handle multiple JWK Sets would be a good idea.
I do see the value in a generalized keyfunc
for multiple JWK Sets and may add it to the keyfunc
project. Probably a generalized implementation and not tied to gofiber
. This would come with the caveat that key ID collisions would need to be noted for package users, although I am unsure about the specific implementation details for that case.
I agree with your decision to not use the github.com/gofiber/jwt
package at this time. This is because an old, pre-release, version of keyfunc
was copied into this project and modified but never updated. It contains multiple known bugs that have since been fixed.
What is your opinion on the default behavior of key ID collisions? An error? Selecting the first one silently? Should a package user of keyfunc
be able to specify key ID collision behavior? Could you provide me with more details of what you would like a function that accepts multiple HTTPS URLs for separate JWKS to look like? I am not very familiar with gofiber
as a framework and would prefer a more generalized discussion, if possible.
Thank you for the quick response @MicahParks!
It looks like the specific request in this issue is to accept multiple HTTPS URLs for separate JWKS as arguments. Let me know if I read that incorrectly.
That is absolutely correct! 💯 I also do agree that it would be better to add an additional method/struct to support multiple JWKS URLs instead of modifying the existing keyFunc.Get
- it's good as it is!
What is your opinion on the default behavior of key ID collisions? An error? Selecting the first one silently? Should a package user of keyfunc be able to specify key ID collision behavior?
Uhm, I would leave the decision to the package user, it will depend on the usage. For my case it's not an issue as we're using UUIDv4
s as key IDs mainly, so for me it would be select the first one found silently
as implemented in the code in the issue body.
Could you provide me with more details of what you would like a function that accepts multiple HTTPS URLs for separate JWKS to look like? I am not very familiar with gofiber as a framework and would prefer a more generalized discussion, if possible.
As far as I can tell this is not more fiber specific than the matching of KeyFunc
interfaces. :) I don't know hot it looks like for other users, but for me a simple list of strings with URLs to JWKS endpoints (regardless of HTTP in case of local development or HTTPS after deployment) would be perfectly enough.
If you want I can try to open a PR with what I have so far, otherwise you can use my code if you want and start from there :) However you like!
Best, Alex
Thank you for your input. A pull request would be very welcome!
@aklinkert, I'd like to invite you to review https://github.com/MicahParks/keyfunc/pull/78. I believe this PR addresses this issue.
Hi @MicahParks,
I am using JWKS in a service-to-service token communication and would prefer to use
keyfunc
over the default implementation in https://github.com/gofiber/jwt. In order to have a list of trusted JWKS (one per service) this package would need to accept multiple JWKS endpoints natively.Right now I am bridging the gap by creating one keyfunc per endpoint and iterating all of the keyfuncs, where
trustedJWKSEndpoints
holds a[]string
of trusted JWKS endpoints.Thank you for providing this library!
Best, Alex
This is what I am doing right now: