How to invalidate cache of RemoteJWKSet in nimbus-jose-jwt

Issue #287 resolved
Former user created an issue

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

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?

Comments (4)

  1. vamsh cl

    @Vladimir Dzhuvinov

    but to insert null, do i have to write an endpoint to explicitly do this when i want a cache refresh.

  2. Vladimir Dzhuvinov

    The endpoint URL should return a valid JWK set, otherwise the code is going to throw an error.

    To force a cache refresh invalidate the cache as shown above.

    RemoteJWK.getJWKSetCache().put(null);
    

  3. Log in to comment