NetDevPack / Security.Jwt

Jwt Manager. Set of components to deal with Jwt Stuff. Automate your key rotating, add support for jwks_uri. Store your cryptography keys in a secure place.
MIT License
271 stars 38 forks source link

Question: does EF core store use caching? #40

Closed kirill-gerasimenko-da closed 1 year ago

kirill-gerasimenko-da commented 1 year ago

Hi!

I've started using the project and doing some experiments under the load, and the access time for the current keys to generate the token caught my attention and I've started digging. So I noticed that here https://github.com/NetDevPack/Security.Jwt/blob/5200210266c4563fa3ce674294d7a2767eb76618/src/NetDevPack.Security.Jwt.Store.EntityFrameworkCore/DatabaseJsonWebKeyStore.cs#L64 it does call the database, despite the cache hit. Is this something expected? I'd think that it just has to return credentials found in the memory cache at this point. To compare - I've checked with file system store implementation - and it works as I would expect, returning credentials found in the memory cache.

Please advise.

Thanks for the great library!

kirill-gerasimenko-da commented 1 year ago

I'm willing to put a PR up, if necessary :)

brunobritodev commented 1 year ago

Definetely, this code doesnt make sense, it should return from cache instead take it again from database.

A PR will be welcome!

kirill-gerasimenko-da commented 1 year ago

Great!

I've got weird issue with the change I'm making - the file I'm changing is in UTF-16LE encoding, and it gets recognized as binary by GitHub. I tried to do changes directly in GitHub, but with the same results. I'll try to work around this.

kirill-gerasimenko-da commented 1 year ago

Like in here https://github.com/kirill-gerasimenko-da/Security.Jwt/commit/bd8c167a5c763f1f0fed1ab28c12020cadcd405c?diff=split#diff-02a402020f707191067d8e3ea8f99d6b1128292d2975d300001beeb37134ae49 - file is shown as binary, but if you open it up - it works and has the changes, weird.

kirill-gerasimenko-da commented 1 year ago

https://github.com/NetDevPack/Security.Jwt/pull/41

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 7.1.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: