From 816d37281d1110ad3a0085f9210633e4219612db Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Wed, 10 Jun 2026 17:44:58 +0800 Subject: [PATCH] Add grants expiry to Auth context (#4581) --- pkg/service/auth.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/service/auth.go b/pkg/service/auth.go index 4550296d..d019c4aa 100644 --- a/pkg/service/auth.go +++ b/pkg/service/auth.go @@ -150,9 +150,14 @@ func GetAPIKey(ctx context.Context) string { } func WithGrants(ctx context.Context, grants *auth.ClaimGrants, apiKey string) context.Context { + return WithGrantsExpiry(ctx, grants, apiKey, time.Time{}) +} + +func WithGrantsExpiry(ctx context.Context, grants *auth.ClaimGrants, apiKey string, expiresAt time.Time) context.Context { return context.WithValue(ctx, grantsKey{}, &grantsValue{ - claims: grants, - apiKey: apiKey, + claims: grants, + apiKey: apiKey, + expiresAt: expiresAt, }) }