Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TokenExpired error = errors.New("Token is expired") TokenNotValidYet error = errors.New("Token is not valid yet") TokenMalformed error = errors.New("This is not a token") TokenInvalid error = errors.New("Couldn't handle this token") SignKey string = "dubbo-go-pixiu" // TODO: The signature information is set to be dynamically obtained )
Constant
Functions ¶
Types ¶
type CustomClaims ¶
type CustomClaims struct { Username string `json:"username"` // The StandardClaims structure implements the Claims interface (Valid() function) jwt.StandardClaims }
Custom Claims
type JWT ¶
type JWT struct {
SigningKey []byte
}
JWT Signature structure
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims CustomClaims) (string, error)
CreateToken Generate token (based on user basic information) HS256 algorithm
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
ParseToken
Click to show internal directories.
Click to hide internal directories.