package ticket import "github.com/golang-jwt/jwt/v5" type Claims struct { ID string `json:"jti,omitempty"` // ticket编号 UID uint `json:"uid"` // 用户编号 Role string `json:"role"` // 账号类型 Issuer string `json:"iss,omitempty"` // 签发人 Subject string `json:"sub,omitempty"` // 主题 Audience jwt.ClaimStrings `json:"aud,omitempty"` // 受众 ExpiresAt *jwt.NumericDate `json:"exp,omitempty"` // 过期时间 NotBefore *jwt.NumericDate `json:"nbf,omitempty"` // 生效时间 IssuedAt *jwt.NumericDate `json:"iat,omitempty"` // 签发时间 } // GetExpirationTime implements the Claims interface. func (c *Claims) GetExpirationTime() (*jwt.NumericDate, error) { return c.ExpiresAt, nil } // GetNotBefore implements the Claims interface. func (c *Claims) GetNotBefore() (*jwt.NumericDate, error) { return c.NotBefore, nil } // GetIssuedAt implements the Claims interface. func (c *Claims) GetIssuedAt() (*jwt.NumericDate, error) { return c.IssuedAt, nil } // GetAudience implements the Claims interface. func (c *Claims) GetAudience() (jwt.ClaimStrings, error) { return c.Audience, nil } // GetIssuer implements the Claims interface. func (c *Claims) GetIssuer() (string, error) { return c.Issuer, nil } // GetSubject implements the Claims interface. func (c *Claims) GetSubject() (string, error) { return c.Subject, nil }