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

JWT: support public keys caching #15786

Open
BaurzhanSakhariev opened this issue Apr 2, 2024 · 3 comments
Open

JWT: support public keys caching #15786

BaurzhanSakhariev opened this issue Apr 2, 2024 · 3 comments

Comments

@BaurzhanSakhariev
Copy link
Contributor

BaurzhanSakhariev commented Apr 2, 2024

Problem Statement

JWK endpoints expose keys which typically are not frequently rotated.
Currently CrateDB requests public keys on each authentication request which might be too expensive.

We could add support of Cache-Control: max-age header (value in seconds) to control caching policy per authentication provider.

Some details:
https://github.com/auth0/java-jwt already supports caching, but we need to cache JwkProvider instances on our own (instead of creating it per request in jwkProvider) to actually utilize caching.

@BaurzhanSakhariev BaurzhanSakhariev changed the title Add public keys caching JWT: support public keys caching Apr 2, 2024
@proddata
Copy link
Member

proddata commented Apr 2, 2024

Isn't this considered a bug, as the caching mechanism was mentioned in the original issue #14238 ?

@seut
Copy link
Member

seut commented Apr 2, 2024

Isn't this considered a bug, as the caching mechanism was mentioned in the original issue #14238 ?

Why would this justify to treat this as a bug? AFAIK this is not related to a functional part but rather an optimization. Or is something breaking without a cache in place?

@proddata
Copy link
Member

proddata commented Apr 2, 2024

Why would this justify to treat this as a bug? AFAIK this is not related to a functional part but rather an optimization. Or is something breaking without a cache in place?

Sorry, should have been more clear. When we were providing feedback on this feature the assumption was that caching is part of the initial scope and there was maybe just as slight issue why it was not working properly. What is unclear from the documentation: Would the current behavior for every query / POST to /_sql fetch the public key from the remote server? That seems excessive and potentially slow down querying by quite a lot.

So not a bug, but rather a non-functional requirement for the initial feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Candidates
Development

No branches or pull requests

3 participants