token

package
v0.0.0-...-fb7e41f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Token_DefaultLifeSeconds = 60 * 30 //token默认有效期,默认30分钟有效期
)

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(ctx dotweb.Context) error

创建token Author: panxinming CreateTime: 2017-02-10 12:00 HttpMethod:Post Post Param:TokenInfo 返回结构:HandlerResponse 0: 成功 -100001:post data not legal -100002:AppID is empty -200001:no config RedisID_Token Redis -200002:create token error [uuid] -200003:create token error [redis set] Response.Message = TokenInfo

UPDATE LOG: 1、初始版本 --2017-02-10 12:00 by pxm

func QueryToken

func QueryToken(ctx dotweb.Context) error

查询token Author: panxinming CreateTime: 2017-02-10 12:00 HttpMethod:Get Get Param: appid: 应用编码 token: token 返回结构:HandlerResponse 0: 成功 -100001:querystring token|appid is empty -200001:no config RedisID_Token Redis -200002:query token error [redis get] Response.Message = TokenInfo

UPDATE LOG: 1、初始版本 --2017-02-10 12:00 by pxm

func VerifyToken

func VerifyToken(ctx dotweb.Context) error

验证token Author: panxinming CreateTime: 2017-02-10 12:00 HttpMethod:Post Post Param:VerifyTokenRequest 返回结构:HandlerResponse 0: 成功 -100001:post data not legal -100002:AppID is empty -200001:no config RedisID_Token Redis -201001: query token exists error -201002: redis token not exists -202001: get token-locker error -202002: token-locker locked by other -203001: query token error -203002: redis token data not legal -203003: token body is not match

Response.Message = TokenInfo

UPDATE LOG: 1、初始版本 --2017-02-10 12:00 by pxm

Types

type TokenInfo

type TokenInfo struct {
	Token       string
	AppID       string
	TokenBody   string
	LifeSeconds int //有效时间,单位为秒
}

type VerifyTokenRequest

type VerifyTokenRequest struct {
	Token       string
	AppID       string
	TokenBody   string
	IsCheckBody bool //是否需要验证Body是否一致
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL