add: envoy redis

This commit is contained in:
wwweww
2026-02-23 15:54:33 +08:00
parent 26864d578e
commit 4898aecd3b
79 changed files with 9520 additions and 650 deletions
+30
View File
@@ -0,0 +1,30 @@
package utils
import (
"errors"
"time"
)
type TokenPayload struct {
UserId string
IsAdmin bool
}
const (
tokenCachePrefixUser = "jwt:user:"
tokenCachePrefixToken = "jwt:token:"
tokenCacheTTL = 60 * 24 * time.Hour
tokenLifetime = 5 * 24 * time.Hour
)
var (
errMissingToken = errors.New("token missing in request")
errInvalidToken = errors.New("invalid token claims")
errTokenNotInCache = errors.New("token not found in cache")
errNoRedisClient = errors.New("redis client not configured")
)
func NewToken(payload TokenPayload) (string, error) {
return "", nil
}