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

Add backgroundRefresh for initially failing JWKs from keyfunc.GetMultiple #90

Closed
ErenDursun opened this issue May 31, 2023 · 1 comment · Fixed by #91
Closed

Add backgroundRefresh for initially failing JWKs from keyfunc.GetMultiple #90

ErenDursun opened this issue May 31, 2023 · 1 comment · Fixed by #91

Comments

@ErenDursun
Copy link

Hi, first of all: thanks for this great repository!

When using keyfunc.GetMultiple to retrieve JWKs from multiple URLs with a configuration to refresh those keys, then during runtime some of the URLs might have a downtime and when they are up again all will self-heal after a background refresh - and that's neat!

But what if one of many URLs isn't accesible at startup, due to let's say maintenance? Can we have the keyfunc.GetMultiple function load from all working URLs and have the rest loaded later via background refresh?

So far I couldn't find a way to achieve this from outside the library without reimplementing large parts of it. But adding a new parameter to the keyfunc.Options could solve this in a much simpler way.

Thanks for looking into it :)

@MicahParks
Copy link
Owner

Thank you for opening this issue and the kind words, @ErenDursun. I think the use case may be more practical than I initially thought.

You are correct, this could be solved in a simpler way using keyfunc.Options. I've created a small pull request to add that feature. You can see it in #91. I'm going to merge that pull request shortly, then release the feature in v2.1.0.

The new field on keyfunc.Options, TolerateInitialJWKHTTPError supports this use case. In order to pair this with keyfunc.GetMultiple, you should set this field to true for all JWK Set URLs in the map[string]keyfunc.Options argument where it is possible the JWK Set would be unavailable during the function call.

Please feel free to continue commenting on the issue or reopen it if the newly added feature does not meet your expectations.

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

Successfully merging a pull request may close this issue.

2 participants