Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the docs - smallrye.jwt.resolve-remote-keys-at-startup and cache #818

Open
zilinjak opened this issue Aug 19, 2024 · 2 comments
Open

Comments

@zilinjak
Copy link

Hey,
lately I have been using smallrye jwt a lot. I have found bug where the cache of JWKS wasn't being refreshed.
This ended up due to the implementation of smallrye.jwt.resolve-remote-keys-at-startup can you please fix the docs and add note that the smallrye.jwt.resolve-remote-keys-at-startup will mean that the keys will be fetched at start and cache WON'T be used.

@sberyozkin
Copy link
Contributor

@zilinjak Hi, it is not a doc bug then but the runtime bug, as in this this case the keys must be refreshable

@luneo7
Copy link
Contributor

luneo7 commented Nov 15, 2024

I've read the code and it seems that it is not a bug, as it sets to fetch only once by design, when we have resolve-remote-keys-at-startup set to true it doesn't use HttpsJWKS, but rather fetch the key only once from an URL and calls setPublicKeyContent or setDecryptionKeyContent in JWTAuthContextInfoProvider. And the HttpsJWKS is only created if setPublicKeyLocation was called in the JWTAuthContextInfoProvider, and when parseClaims is first called in DefaultJWTTokenParser, that will trigger a creation of a JwtConsumer that will trigger in first invocation the creation of KeyLocationResolver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants