Documentation ¶
Overview ¶
Package jwt provides functions for generating and validating JWT tokens.
Package jwt provides functions for generating and validating JWT tokens.
Index ¶
- Constants
- func NewTokenSerializer(ts ...SerializeSetting) security.TokenSerializer
- type Claims
- func (c *Claims) GetAudience() (jwt.ClaimStrings, error)
- func (c *Claims) GetExpirationTime() (*jwt.NumericDate, error)
- func (c *Claims) GetIssuedAt() (*jwt.NumericDate, error)
- func (c *Claims) GetIssuer() (string, error)
- func (c *Claims) GetNotBefore() (*jwt.NumericDate, error)
- func (c *Claims) GetSubject() (string, error)
- type Serialize
- type SerializeSetting
- func WithDomain(domain string) SerializeSetting
- func WithExpired(expired int) SerializeSetting
- func WithKey(key string, keys ...string) SerializeSetting
- func WithKeyFns(keyFns ...func(*jwt.Token) (any, error)) SerializeSetting
- func WithParser(parser *jwt.Parser) SerializeSetting
- func WithSigningMethod(method jwt.SigningMethod) SerializeSetting
- func WithTokenType(tokenType string) SerializeSetting
Constants ¶
View Source
const ErrInvalidToken = errors.String("invalid token")
Variables ¶
This section is empty.
Functions ¶
func NewTokenSerializer ¶
func NewTokenSerializer(ts ...SerializeSetting) security.TokenSerializer
Types ¶
type Claims ¶
func (*Claims) GetAudience ¶
func (*Claims) GetExpirationTime ¶
func (*Claims) GetIssuedAt ¶
func (*Claims) GetNotBefore ¶
func (*Claims) GetSubject ¶
type Serialize ¶
type Serialize struct { Parser *jwt.Parser Domain string TokenType string Expired time.Duration Method jwt.SigningMethod Key []byte OldKey []byte KeyFns []func(*jwt.Token) (any, error) }
type SerializeSetting ¶
type SerializeSetting = func(*Serialize)
func WithDomain ¶
func WithDomain(domain string) SerializeSetting
func WithExpired ¶
func WithExpired(expired int) SerializeSetting
func WithKey ¶
func WithKey(key string, keys ...string) SerializeSetting
func WithKeyFns ¶
func WithKeyFns(keyFns ...func(*jwt.Token) (any, error)) SerializeSetting
func WithParser ¶
func WithParser(parser *jwt.Parser) SerializeSetting
func WithSigningMethod ¶
func WithSigningMethod(method jwt.SigningMethod) SerializeSetting
func WithTokenType ¶
func WithTokenType(tokenType string) SerializeSetting
Click to show internal directories.
Click to hide internal directories.