-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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 caching #2698
Comments
Yes, JWTs are validated on each request. Do you know a good implementation of JWT caching? I'm not sure if doing this would be safe. Some references: |
I think caching validation/parsing result is secure as long as cache entry is not available longer than the token validity. I guess https://hackage.haskell.org/package/cache might support what is needed. I will try to provide a patch but it is going to be my first real Haskell adventure :) |
@steve-chavez, for this I am thinking of adding two config options: I guess we need this other config |
@taimoorzaeem Hm, I don't think we need a As for a boolean |
@taimoorzaeem Thinking more about this, we would need a way to test that the jwt decoding is fast the second time. Looks like #2771 might help. Check my comment, for starters it seems possible to add |
From #2771 (comment) here:
@steve-chavez What do you think, should I add |
@taimoorzaeem |
@steve-chavez The exact matching won't work here, because the duration changes from run to run. How should I compare them?
Also, the way I have currently implemented this is that I have made the |
@taimoorzaeem I think we can assert that the 2nd duration will always be less than the 1st. Some light parsing (like using Text.split, there's an example in Mediatype.hs IIRC) could be done to extract the value from the header and compare them. |
Re |
In our set-up we use asymmetric encryption to authenticate JWTs. As crypto operations are quite resource intensive we would like to cache results of JWT validation.
From my limited understanding of Haskell code JWTs are validated and parsed upon every request.
Do you think it would be a good idea to provide a time limited cache of JWT validation/parsing results?
The text was updated successfully, but these errors were encountered: