Documentation ¶
Index ¶
- Variables
- func AbortWithError(c *gin.Context, code int, message string)
- func BindJSON(data io.Reader, dest interface{}) error
- func CalcSign(mReq map[string]interface{}, salt, sign string) string
- func CreateJWTString(id, sub, issuer, key string, expire int) string
- func FilterXSS(s string) string
- func GenPropsByBody(contentType string, body []byte) (map[string]interface{}, error)
- func GetLangContent(code, lang, _default string) string
- func JWTAbortWithError(c *gin.Context, code int, message, realm string)
- func JWTAuth(issuer, key string) gin.HandlerFunc
- func SignedAuth(salt, appid, sign string, salts map[string]interface{}) gin.HandlerFunc
- func StripBearerPrefixFromTokenString(tok string) (string, error)
- func WechatSign(mReq map[string]interface{}, salt, sign string) string
- func WhitelistAuth(whitelist map[string]interface{}) gin.HandlerFunc
- type JWT
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTokenExpired error = errors.New("凭证过期") ErrTokenNotValidYet error = errors.New("凭证还未校验") ErrTokenMalformed error = errors.New("凭证格式错误") ErrTokenInvalid error = errors.New("凭证无效") ErrTokenIssuer error = errors.New("凭证发放者不符") )
Err
Functions ¶
func AbortWithError ¶
AbortWithError AbortWithError
func CreateJWTString ¶
CreateJWTString CreateJWTString
func GenPropsByBody ¶
GenPropsByBody 根据类型分解参数
func GetLangContent ¶
GetLangContent GetLangContent
func JWTAbortWithError ¶
JWTAbortWithError JWTAbortWithError
func SignedAuth ¶
func SignedAuth(salt, appid, sign string, salts map[string]interface{}) gin.HandlerFunc
SignedAuth SignedAuth salt:默认salt; appid:appid的key; sign: 签名的key; salts: salt组
如果请求参数中有appid的key,则匹配salts中配置的该app的salt,否则取默认的salt
func StripBearerPrefixFromTokenString ¶
StripBearerPrefixFromTokenString Strips 'Bearer ' prefix from bearer token string
func WechatSign ¶
WechatSign api md5key为签名参数的key,salt加在后部,如果value没有,不参与签名
func WhitelistAuth ¶
func WhitelistAuth(whitelist map[string]interface{}) gin.HandlerFunc
WhitelistAuth WhitelistAuth
Types ¶
Click to show internal directories.
Click to hide internal directories.