jwt

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

func CreateLongToken(uid string) (*customClaims, string, error)

CreateToken 生成一个token

func CreateToken

func CreateToken(uid string) (string, error)

CreateToken 生成一个token

func ParseToken

func ParseToken(tokenString string) (*customClaims, error)

解析Token

func RefreshToken

func RefreshToken(tokenString string, appid int) (string, error)

更新token

Types

type OBSAuthToken

type OBSAuthToken struct {
	Code    int              `json:"code"`
	Data    OBSAuthTokenData `json:"data"`
	Message string           `json:"message"`
}

OBS 企业服务总线token认证接口返回数据结构

type OBSAuthTokenData

type OBSAuthTokenData struct {
	ExpiresIn int    `json:"expires_in"`
	Token     string `json:"token"`
}

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"`
}

func ParseTokenFromRedis

func ParseTokenFromRedis(tokenString string) (*TokenField, error)

解析Token

Jump to

Keyboard shortcuts

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