Documentation ¶
Index ¶
- Variables
- func CreateToken(m map[string]string, keys ...string) string
- func ParseToken1(tokenString string, keys ...string) (map[string]string, bool)
- type Auther
- type JWTAuth
- func (a *JWTAuth) GenerateToken() (TokenInfo, error)
- func (a *JWTAuth) ParseToken(tokenString string, keys string) (map[string]interface{}, error)
- func (a *JWTAuth) SetClaims(claims jwt.MapClaims)
- func (a *JWTAuth) SetExpired(expired int)
- func (a *JWTAuth) SetKey(key []byte)
- func (a *JWTAuth) SetKeyFunc(key []byte)
- func (a *JWTAuth) SetKeyfunc(keyFunc jwt.Keyfunc)
- func (a *JWTAuth) SetSigningKey(key []byte)
- func (a *JWTAuth) SetSigningMethod(method jwt.SigningMethod)
- type NewFunc
- type Option
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TokenExpired error = errors.New("token is expired") TokenNotValidYet error = errors.New("token not active yet") TokenMalformed error = errors.New("that's not even a token") TokenInvalid error = errors.New("invalid token") ErrInvalidToken error = errors.New("invalid token") )
定义错误
Functions ¶
func CreateToken ¶ added in v1.0.8
创建token
Types ¶
type JWTAuth ¶
type JWTAuth struct {
Options *options
}
JWTAuth jwt认证
func (*JWTAuth) GenerateToken ¶
GenerateToken 生成令牌
func (*JWTAuth) ParseToken ¶
ParseToken 解析令牌
func (*JWTAuth) SetExpired ¶
SetExpired 设定令牌过期时长(unit, default3600)
func (*JWTAuth) SetKeyfunc ¶
SetKeyfunc 设定验证key的回调函数
func (*JWTAuth) SetSigningMethod ¶
func (a *JWTAuth) SetSigningMethod(method jwt.SigningMethod)
SetSigningMethod 设定签名方式
Click to show internal directories.
Click to hide internal directories.