Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type JWT ¶
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(baseClaims JWTBaseClaims) JWTCustomClaims
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims JWTCustomClaims) (string, error)
创建一个token
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*JWTCustomClaims, error)
解析 token
type JWTBaseClaims ¶
type JWTConfig ¶
type JWTConfig struct { SigningKey string `mapstructure:"signing-key" json:"signingKey" yaml:"signing-key"` // jwt签名 ExpiresTime int64 `mapstructure:"expires-time" json:"expiresTime" yaml:"expires-time"` // 过期时间 BufferTime int64 `mapstructure:"buffer-time" json:"bufferTime" yaml:"buffer-time"` // 缓冲时间 Issuer string `mapstructure:"issuer" json:"issuer" yaml:"issuer"` // 签发者 }
type JWTCustomClaims ¶
type JWTCustomClaims struct { JWTBaseClaims BufferTime int64 jwt.StandardClaims }
Click to show internal directories.
Click to hide internal directories.