Skip to content

Commit f2ce717

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

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

claims.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ func MaxAge(maxAge time.Duration) SignOptionFunc {
245245
}
246246

247247
// NoMaxAge is a SignOption to set the expiration "exp", "iat" JWT standard claims to zero.
248-
func NoMaxAge(c *Claims) {
248+
//
249+
// Usage:
250+
// Sign(alg, key, claims, NoMaxAge)
251+
var NoMaxAge SignOptionFunc = func(c *Claims) {
249252
c.Expiry = 0
250253
c.IssuedAt = 0
251254
}

sign.go

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ func signToken(alg Alg, key PrivateKey, encrypt InjectFunc, claims any, customHe
8484
//
8585
// Available SignOptions:
8686
// - MaxAge(time.Duration)
87+
// - NoMaxAge()
88+
// - []Audience{"aud"}
8789
// - Claims{}
8890
type SignOption interface {
8991
// ApplyClaims should apply standard claims.

0 commit comments

Comments
 (0)