Skip to content

Commit 0119551

Browse files
committed
minor: add NoMaxAge sign option helper
1 parent abf430b commit 0119551

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

claims.go

+6
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ func MaxAge(maxAge time.Duration) SignOptionFunc {
244244
}
245245
}
246246

247+
// NoMaxAge is a SignOption to set the expiration "exp", "iat" JWT standard claims to zero.
248+
func NoMaxAge(c *Claims) {
249+
c.Expiry = 0
250+
c.IssuedAt = 0
251+
}
252+
247253
// MaxAgeMap is a helper to set "exp" and "iat" claims to a map claims.
248254
// Usage:
249255
// claims := map[string]any{"foo": "bar"}

0 commit comments

Comments
 (0)