I am currently encountering an issue related to the JWKS endpoint and memory cache. When a pod restarts for any reason, the memory cache is lost, causing us to hit the JWKS endpoint. This is acceptable under normal circumstances, but becomes problematic when pods enter a restart loop, resulting in the memory cache being continuously cleared and the JWKS endpoint being repeatedly called.
This could potentially lead to issues or even a block. To mitigate this, we propose implementing an external cache to store keys, reducing our dependency on the memory cache.
The JWKS-RSA library already has this functionality, as demonstrated here
Additionally, we need access to the getKeys method in the same library to retrieve keys for storage in our external cache.
I hope this clarifies our situation and proposed solution. If it aligns with your understanding, I am prepared to submit a PR for this implementation.
Best Regards.
New or Affected Resource(s)
add a new optional field getKeysInterceptor in VerifierOptions object
expose method: getKeys available in JwksRsa.JwksClient
Describe the feature request?
Hello Team,
I am currently encountering an issue related to the JWKS endpoint and memory cache. When a pod restarts for any reason, the memory cache is lost, causing us to hit the JWKS endpoint. This is acceptable under normal circumstances, but becomes problematic when pods enter a restart loop, resulting in the memory cache being continuously cleared and the JWKS endpoint being repeatedly called.
This could potentially lead to issues or even a block. To mitigate this, we propose implementing an external cache to store keys, reducing our dependency on the memory cache.
The JWKS-RSA library already has this functionality, as demonstrated here
Additionally, we need access to the getKeys method in the same library to retrieve keys for storage in our external cache.
I hope this clarifies our situation and proposed solution. If it aligns with your understanding, I am prepared to submit a PR for this implementation.
Best Regards.
New or Affected Resource(s)
getKeysInterceptor
inVerifierOptions
objectgetKeys
available inJwksRsa.JwksClient
Provide a documentation link
https://github.com/auth0/node-jwks-rsa/blob/master/EXAMPLES.md#loading-keys-from-local-file-environment-variable-or-other-externals
Additional Information?
No response