Documentation ¶
Index ¶
- func NewJwtToken[V any](opts ...JwtTokenOptions) *jwtToken[V]
- type JwtTokenOptions
- func WithAudience(audience string) JwtTokenOptions
- func WithExpired(expired time.Duration) JwtTokenOptions
- func WithIssuer(issuer string) JwtTokenOptions
- func WithSecretKey(secretKey string) JwtTokenOptions
- func WithSecretKeyCallback(callback func() string) JwtTokenOptions
- func WithSigningMethod(signingMethod jwt.SigningMethod) JwtTokenOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewJwtToken ¶
func NewJwtToken[V any](opts ...JwtTokenOptions) *jwtToken[V]
NewJwtToken creates a new JWT token
Types ¶
type JwtTokenOptions ¶
type JwtTokenOptions func(*options)
func WithAudience ¶
func WithAudience(audience string) JwtTokenOptions
WithAudience sets the audience for the jwt token
func WithExpired ¶
func WithExpired(expired time.Duration) JwtTokenOptions
WithExpired sets the expired for the jwt token
func WithIssuer ¶
func WithIssuer(issuer string) JwtTokenOptions
WithIssuer sets the issuer for the jwt token
func WithSecretKey ¶
func WithSecretKey(secretKey string) JwtTokenOptions
WithSecretKey sets the secret key for the jwt token The functionx can not be used with WithSecretKeyCallback together
func WithSecretKeyCallback ¶
func WithSecretKeyCallback(callback func() string) JwtTokenOptions
WithSecretKeyCallback sets the secret key for the jwt token by callback. The callback will be called when the secret key is needed. WithSecretKeyCallback can not be used with WithSecretKey together.
func WithSigningMethod ¶
func WithSigningMethod(signingMethod jwt.SigningMethod) JwtTokenOptions
WithSigningMethod sets the signing method for the jwt token
Click to show internal directories.
Click to hide internal directories.