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?