Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Make cookie expire 1 min earlier than the jwt
天舟347111ebbe2d
diff --git a/backend/server/jwt.go b/backend/server/jwt.goindex b756b594d9..3f721e7bff 100644--- a/backend/server/jwt.go+++ b/backend/server/jwt.go@@ -24,11 +24,12 @@ const (refreshThresholdDuration = 15 * time.MinuteaccessTokenDuration = 1 * time.HourrefreshTokenDuration = 24 * time.Hour- // Cookie expiration is the same as the refresh token.+ // Make cookie expire slightly earlier than the jwt expiration. Client would be logged out if the user+ // cookie expires, thus the client would always logout first before attempting to make a request with the expired jwt.// Suppose we have a valid refresh token, we should refresh the token in 2 cases:// 1. The access token is about to expire in <<refreshThresholdDuration>>// 2. The access token has already expired, we refresh the token so that the ongoing request can pass through- cookieExpDuration = refreshTokenDuration+ cookieExpDuration = refreshTokenDuration - 1*time.Minute// The key name used to store jwt token in the contexttokenContextKey = "token"