users

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(secretKey string, claims CustomClaims) (string, error)

创建一个token

func GetJwtToken

func GetJwtToken(secretKey string, iat, seconds, uid int64, role int64) (string, error)

func RefreshToken

func RefreshToken(tokenString string, secretKey string, AccessExpire int64) (string, error)

更新token

Types

type CustomClaims

type CustomClaims struct {
	Uid int64 `json:",string"`
	jwt.StandardClaims
	Role int64
}

Custom claims structure

func GetClaimsFromToken

func GetClaimsFromToken(l context.Context, uidKey string, roleKey string) *CustomClaims

func ParseToken

func ParseToken(tokenString string, secretKey string) (*CustomClaims, *errors.CodeError)

解析 token

type UserInfoType

type UserInfoType uint8
const (
	Uid        UserInfoType = iota //用户UID
	InviterUid                     //邀请人用户id
	UserName                       //用户登录名
	GroupId                        //用户组id
	Email                          //邮箱
	Phone                          //手机号
	Wechat                         //微信
	InfoMax                        //结束
	AuthId                         //权限id
)

func GetLoginNameType

func GetLoginNameType(userName string) UserInfoType

type UserStatus

type UserStatus = int64
const (
	NotRegisterStatus UserStatus = iota //未注册完成状态只注册了第一步
	NormalStatus                        //正常状态
)

Jump to

Keyboard shortcuts

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