Documentation ¶
Index ¶
- Variables
- func DestroyToken(token string) error
- func GenToken(data interface{}) (string, error)
- func SetHandle(jwtHandle *Handle)
- func ValidToken(token string) bool
- func ValidTokenHttp(req *http.Request) bool
- type Config
- type Handle
- func (r *Handle) ExtractClaimsFromToken(token *jwt.Token) MapClaims
- func (r *Handle) ParseHttp(req *http.Request) (MapClaims, error)
- func (r *Handle) ParseToken(token string) (MapClaims, error)
- func (r *Handle) SetKey(key []byte) *Handle
- func (r *Handle) TokenDestroy(token string) error
- func (r *Handle) TokenGenerator(data interface{}) (string, error)
- func (r *Handle) TokenParse(token string) (*jwt.Token, error)
- func (r *Handle) TokenValid(token string) bool
- func (r *Handle) ValidHttp(req *http.Request) bool
- type MapClaims
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var Storer = NewStore()
Storer 黑名单存储接口
Functions ¶
func ValidTokenHttp ¶ added in v1.0.6
校验http请求是否有有效的授权认证信息
Types ¶
type Handle ¶
type Handle struct { *Config // contains filtered or unexported fields }
jwt操作
func (*Handle) ExtractClaimsFromToken ¶ added in v1.0.6
ExtractClaimsFromToken help to extract the JWT claims from token
func (*Handle) TokenGenerator ¶ added in v1.0.6
生成token
func (*Handle) TokenParse ¶ added in v1.0.6
解析token,返回claims信息, 如果token无效,则error将会展示错误信息, 如果token有效,customClaims将会返回连接用户的信息
func (*Handle) TokenValid ¶ added in v1.0.6
根据token校验token是否有效 如果token有效,则返回true,否则返回false
Click to show internal directories.
Click to hide internal directories.