Documentation
¶
Index ¶
- Variables
- func Eq(mark string) string
- func Ge(mark string) string
- func Gt(mark string) string
- func Le(mark string) string
- func Lt(mark string) string
- func MD5V(str []byte, b ...byte) string
- func Md5ByBytes(b []byte) string
- func Md5ByString(str string) string
- func Ne(mark string) string
- func NotEmpty() string
- func RegexpMatch(rule string) string
- func RegisterRule(key string, rule Rules) (err error)
- func Verify(st interface{}, roleMap Rules) (err error)
- type BaseClaims
- type CustomClaims
- type JWT
- func (j *JWT) CreateClaims(baseClaims BaseClaims, bufferTime int64, expireTime int64, issure string) CustomClaims
- func (j *JWT) CreateToken(claims CustomClaims) (string, error)
- func (j *JWT) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)
- func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
- type Rules
- type RulesMap
- type SnowFlake
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TokenExpired = errors.New("Token is expired") TokenNotValidYet = errors.New("Token not active yet") TokenMalformed = errors.New("That's not even a token") TokenInvalid = errors.New("Couldn't handle this token:") )
View Source
var CustomizeMap = make(map[string]Rules)
View Source
var (
GVA_Concurrency_Control = &singleflight.Group{}
)
Functions ¶
func Md5ByBytes ¶
func Md5ByString ¶
func RegexpMatch ¶
@author: [zooqkl](https://github.com/zooqkl) @function: RegexpMatch @description: 正则校验 校验输入项是否满足正则表达式 @param: rule string @return: string
func RegisterRule ¶
Types ¶
type BaseClaims ¶
type CustomClaims ¶
type CustomClaims struct { BaseClaims BufferTime int64 jwt.StandardClaims }
Custom claims structure
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(baseClaims BaseClaims, bufferTime int64, expireTime int64, issure string) CustomClaims
func (*JWT) CreateTokenByOldToken ¶
func (j *JWT) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)
CreateTokenByOldToken 旧token 换新token 使用归并回源避免并发问题
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
解析 token
Click to show internal directories.
Click to hide internal directories.