jwt/token_option.go

18 lines
419 B
Go
Raw Normal View History

package jwt
// TokenOption is a reserved type, which provides some forward compatibility,
// if we ever want to introduce token creation-related options.
type TokenOption func(*Token)
func WithJSONEncoder(f JSONMarshalFunc) TokenOption {
return func(token *Token) {
token.jsonMarshal = f
}
}
2023-09-14 22:25:59 +03:00
func WithBase64Encoder(enc Base64Encoding) TokenOption {
return func(token *Token) {
2023-09-14 22:25:59 +03:00
token.base64Encoding = enc
}
}