2

We are making use of RemoteJWKSet in nimbus-jose-jwt third party library for JWKS endpoint based JWT validation.

With RemoteJWKSet, we can retrieve the JWKS from a remote endpoint and the retrieved JWK set is cached in order to to minimize network calls. Also it is capable of handling key rotation at the remote server since the cache is updated whenever the key selector tries to get a key with an unknown KID.

My question is that, let's say a particular key set is removed from the remote JWKS endpoint due to security reasons. But when we get a JWT that was signed using the removed key, it will still be valid since that keyset is available in the cache (RemoteJWKSet will only update the cache when it gets a token with an unknown KID).

I need to know is there any possible way to invalidate the cached JWK set in RemoteJWKSet if required other that restarting the server?

sathya
  • 523
  • 1
  • 4
  • 18

1 Answers1

3

Raised the same question at connect2id support portal [1]

They have suggested to put an empty JWK set which will cause the RemoteJWKSet to reload the key set from the URL on the next call as a mechanism to invalidate the JWKS cache.

[1] https://bitbucket.org/connect2id/nimbus-jose-jwt/issues/287/how-to-invalidate-cache-of-remotejwkset-in

sathya
  • 523
  • 1
  • 4
  • 18
  • but how did you insert null, - did you have to write an endpoint to explicitly do this when you wanted a cache refresh. – samshers Nov 20 '21 at 20:13