Add capability for using stale cache while JWKS endpoint is down #415
Replies: 2 comments 1 reply
-
I think this is a very important feature. It's not good for a network issue or outage on the JWKS endpoint to take down the JWT-secured API, so it leaves us with two choices:
Would it be reasonable to update getKey to catch errors on this.Reload() and continue if there was an error in reloading the cache? Line 117 in f009cc1 Maybe there can be config of whether to allow using a stale cache? Alternatively, there could be a staleMaxAge as well, so you could have your config set like this: cacheMaxAge: 1 day So it will try to refresh after 1 day, but if there's errors on reload() it will use the stale cache up to another day, after which it will start returning errors like it currently does. The staleMaxAge could default to be the same as cacheMaxAge if not set. Would you be open to a pull request for this feature? |
Beta Was this translation helpful? Give feedback.
-
@panva, my proposal would be to create a Would you be willing to consider a pull request with this feature if I submitted it? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Sometimes the JWKS endpoint may be down. In these cases, it would be useful if jose could still use a stale version of the cached keys even after cacheMaxAge has passed to avoid outages in a service.
Beta Was this translation helpful? Give feedback.
All reactions