Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TokenExpiredErr = errors.New("token expired")
View Source
var TokenInvalidErr = errors.New("token invalid")
View Source
var TokenMalformedErr = errors.New("token malformed error")
View Source
var TokenNotValidYetErr = errors.New("token not valid yet")
Functions ¶
func GenToken ¶
func GenToken(claim Certification) (string, error)
func Initialize ¶
Types ¶
type Certification ¶
type Certification struct { jwt.StandardClaims // 自定义字段,添加自己需要的信息 UserId int Username string //盐,随机数 Salt string }
认证对象
func ParseToken ¶
func ParseToken(token string) (*Certification, error)
Click to show internal directories.
Click to hide internal directories.