Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomClaims ¶
type CustomClaims struct { UserId int64 `form:"userid" json:"userid"` Name string `form:"user_name" json:"user_name"` Phone string `form:"phone" json:"phone"` jwt.StandardClaims }
自定义jwt的声明字段信息+标准字段,参考地址:https://blog.csdn.net/codeSquare/article/details/99288718
type JwtSign ¶
type JwtSign struct {
SigningKey []byte
}
定义一个 JWT验签 结构体
func (*JwtSign) CreateToken ¶
func (j *JwtSign) CreateToken(claims CustomClaims) (string, error)
CreateToken 生成一个token
func (*JwtSign) ParseToken ¶
func (j *JwtSign) ParseToken(tokenString string) (*CustomClaims, error)
解析Token
Click to show internal directories.
Click to hide internal directories.