Documentation ¶
Index ¶
- type JwtMng
- func (mng *JwtMng) CompareJwtCache(appID, userID int, token string) error
- func (mng *JwtMng) Decrypt(claims jwt.Claims, tokenStr string) error
- func (mng *JwtMng) DecryptWithoutValidation(claims jwt.Claims, tokenStr string) error
- func (mng *JwtMng) DeleteCache(appID, userID int) (int64, error)
- func (mng *JwtMng) FromAuthHeader(authHeader string) (string, error)
- func (mng *JwtMng) GetCache(appID, userID int) (string, error)
- func (mng *JwtMng) GetTokenStr(claims jwt.Claims) (string, error)
- func (mng *JwtMng) RefreshToken(ctx iris.Context, validDuration float64)
- func (mng *JwtMng) Serve(ctx iris.Context)
- func (mng *JwtMng) SetCache(appID, userID int, token string) (int64, error)
- type TokenData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JwtMng ¶
type JwtMng struct { AppID int `json:"app_id"` // app_id 主要用来区别登陆 IdentifyKey string `json:"identify_key"` // 身份标识键名,这个key必须存在于tokenStruct里 TokenStruct jwt.Claims `json:"token_struct"` SaltKey []byte `json:"salt_key"` // 盐值 IsSingletonMode bool `json:"is_singleton_mode"` // 是否单例登陆模式 }
func GetJwtMng ¶
func GetJwtMng(appID int, isSingletonMode bool, identifyKey, saltKey string, tokenStruct jwt.Claims) *JwtMng
GetJwtMng 获取jwt管理器
func (*JwtMng) CompareJwtCache ¶ added in v0.5.2
CompareJwtCache 判断jwtToken
func (*JwtMng) DecryptWithoutValidation ¶ added in v0.5.2
DecryptWithoutValidation 解码但不验证时间
func (*JwtMng) DeleteCache ¶ added in v0.5.2
DeleteCache 从缓存中删除jwt
func (*JwtMng) FromAuthHeader ¶
FromAuthHeader 从header头中获取jwt
func (*JwtMng) GetTokenStr ¶
GetTokenStr: 获取jwt token
func (*JwtMng) RefreshToken ¶ added in v0.5.2
RefreshToken 刷新token
Click to show internal directories.
Click to hide internal directories.