Documentation ¶
Index ¶
- Variables
- func CreateLongToken(uid string) (*customClaims, string, error)
- func CreateToken(uid string) (string, error)
- func ParseToken(tokenString string) (*customClaims, error)
- func RefreshToken(tokenString string, appid int) (string, error)
- type OBSAuthToken
- type OBSAuthTokenData
- type TokenField
- type TokenFieldOption
- func AppId(n string) TokenFieldOption
- func DeviceId(n string) TokenFieldOption
- func DeviceName(n string) TokenFieldOption
- func Platform(n string) TokenFieldOption
- func RealName(n string) TokenFieldOption
- func UserId(n string) TokenFieldOption
- func UserName(n string) TokenFieldOption
- func UserType(n string) TokenFieldOption
- type TokenFieldService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TokenExpired = errors.New("Token 已过期") TokenNotValidYet = errors.New("Token 未激活") TokenMalformed = errors.New("这不是 Token") TokenInvalid = errors.New("无法解析的 Token") SignKey = []byte(config.C.Jwt.SignKey) )
一些常量
Functions ¶
func CreateLongToken ¶
CreateToken 生成一个token
Types ¶
type OBSAuthToken ¶
type OBSAuthToken struct { Code int `json:"code"` Data OBSAuthTokenData `json:"data"` Message string `json:"message"` }
OBS 企业服务总线token认证接口返回数据结构
type OBSAuthTokenData ¶
type TokenField ¶
type TokenField struct { AppId string `json:"app_id"` UserId string `json:"user_id"` Platform string `json:"platform"` DeviceId string `json:"device_id"` DeviceName string `json:"device_name"` UserName string `json:"user_name"` RealName string `json:"real_name"` UserType string `json:"user_type"` }
func ParseTokenFromRedis ¶
func ParseTokenFromRedis(tokenString string) (*TokenField, error)
解析Token
func (*TokenField) RetMap ¶ added in v1.4.9
func (tf *TokenField) RetMap() map[string]interface{}
type TokenFieldOption ¶ added in v1.4.9
type TokenFieldOption func(o *TokenField)
Option for web
func AppId ¶ added in v1.4.9
func AppId(n string) TokenFieldOption
func DeviceId ¶ added in v1.4.9
func DeviceId(n string) TokenFieldOption
func DeviceName ¶ added in v1.4.11
func DeviceName(n string) TokenFieldOption
func Platform ¶ added in v1.4.9
func Platform(n string) TokenFieldOption
func RealName ¶ added in v1.4.9
func RealName(n string) TokenFieldOption
func UserId ¶ added in v1.4.9
func UserId(n string) TokenFieldOption
func UserName ¶ added in v1.4.9
func UserName(n string) TokenFieldOption
func UserType ¶ added in v1.4.9
func UserType(n string) TokenFieldOption
type TokenFieldService ¶ added in v1.4.9
type TokenFieldService interface { RetMap() map[string]interface{} RetStruct(map[string]string) error }
func NewTokenField ¶ added in v1.4.9
func NewTokenField(opts ...TokenFieldOption) TokenFieldService
NewService returns a new web.Service
Click to show internal directories.
Click to hide internal directories.