Documentation ¶
Index ¶
- func CreateToken(secretKey string, claims CustomClaims) (string, error)
- func GetJwtToken(secretKey string, iat, seconds, uid int64, role int64) (string, error)
- func RefreshToken(tokenString string, secretKey string, AccessExpire int64) (string, error)
- type CustomClaims
- type UserInfoType
- type UserStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateToken ¶
func CreateToken(secretKey string, claims CustomClaims) (string, error)
创建一个token
func GetJwtToken ¶
Types ¶
type CustomClaims ¶
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 //正常状态 )
Click to show internal directories.
Click to hide internal directories.