Documentation
¶
Index ¶
- func CreateToken(secretKey string, claims jwt.Claims) (string, error)
- func GetRegisterToken(secretKey string, t time.Time, seconds int64, RejType, Note string, Code int64) (string, error)
- func ParseToken(claim jwt.Claims, tokenString string, secretKey string) error
- func ParseTokenWithFunc(claim jwt.Claims, tokenString string, f jwt.Keyfunc) error
- func RefreshLoginToken(tokenString string, secretKey string, AccessExpire int64) (string, error)
- type LoginClaims
- type OpenClaims
- type RegType
- type RegisterClaims
- type UserInfo
- type UserInfoType
- type UserStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRegisterToken ¶
func ParseToken ¶
解析 token
func ParseTokenWithFunc ¶
Types ¶
type LoginClaims ¶
type LoginClaims struct {
UserID int64 `json:",string"`
AppCode string
DeviceID string `json:""`
jwt.RegisteredClaims
}
Custom claims structure
type OpenClaims ¶
type OpenClaims struct {
UserID int64 `json:"userID,string"` //账号
TenantCode string `json:"tenantCode"`
Code string `json:"code"`
jwt.RegisteredClaims
}
Custom claims structure
type RegType ¶
type RegType = string
const ( RegEmail RegType = "email" //邮箱 RegPhone RegType = "phone" //手机号 RegWxOpen RegType = "wxOpen" //微信开放平台登录 RegWxIn RegType = "wxIn" //微信内登录 RegWxMiniP RegType = "wxMiniP" //微信小程序 RegWxOfficial RegType = "wxOfficial" //微信公众号登录 RegDingApp RegType = "dingApp" //钉钉应用(包含小程序,h5等方式) RegPwd RegType = "pwd" //账号密码注册 RegGoogle RegType = "google" //google RegGithub RegType = "github" //github RegHuawei RegType = "huawei" //华为 RegJwt RegType = "jwt" //第三方jwt加密登录 )
phone 手机号 wxOpen 微信开放平台 wxIn 微信内 wxMiniP 微信小程序 pwd 账号密码
type RegisterClaims ¶
type RegisterClaims struct {
RejType string `json:",string"` //注册方式: phone手机号注册 wxopen 微信开放平台登录 wxin 微信内登录 wxminip 微信小程序 pwd 账号密码注册
Note string //手机号 微信unionid 用户名
Code int64 //账密注册时的密码
jwt.RegisteredClaims
}
Custom claims structure
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.