fix: invalid JWTs after jwt-secret is changed in a config reload (#4015)

This commit is contained in:
Taimoor Zaeem
2025-04-16 09:40:36 -05:00
committed by GitHub
parent feb5b7d494
commit bc5ec43300
4 changed files with 55 additions and 6 deletions
+5
View File
@@ -9,6 +9,7 @@ module PostgREST.Auth.JwtCache
( init
, JwtCacheState
, lookupJwtCache
, emptyCache
) where
import qualified Data.Aeson as JSON
@@ -77,3 +78,7 @@ getTimeSpec res maxLifetime utc = do
case expireJSON of
Just (JSON.Number seconds) -> TimeSpec (sciToInt seconds - utcToSecs utc) 0
_ -> TimeSpec (fromIntegral maxLifetime :: Int64) 0
-- | Empty the cache (done when the config is reloaded)
emptyCache :: JwtCacheState -> IO ()
emptyCache JwtCacheState{jwtCache} = C.purge jwtCache