Documentation
¶
Index ¶
- Variables
- func Check(...) (tokenID int64, err error)
- func CheckByKey(...) (err error)
- func CheckTokenS(val string) (b bool)
- func Create(args *ArgsCreate) (tokenID int64, errCode string, err error)
- func CreateTokenS(tokenID int64) (val string)
- func DeleteToken(id int64)
- func DeleteTokenByLoginFrom(loginFrom string)
- func DeleteTokenSByTokenID(tokenID int64) (err error)
- func Init()
- func SelectOrgAndBindID(id int64, orgID int64, orgBindID int64) (err error)
- func UpdateExpire(args *ArgsUpdateExpire) error
- type ArgsCreate
- type ArgsGetList
- type ArgsUpdateExpire
- type FieldsToken
- type FieldsTokenS
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //OpenSub 是否启动订阅 OpenSub = false )
Functions ¶
func Check ¶
func Check(action, urlAction, timestamp, nonce, secretID, signatureKey, signatureMethod string) (tokenID int64, err error)
Check 检查token
func CheckByKey ¶
func CheckByKey(action, urlAction, timestamp, nonce, secretID, signatureKey, signatureMethod, key string) (err error)
CheckByKey 计算密钥数据包 原先位于RouterMid中间件声明 action/timestamp/nonce/secretID/signatureKey/signatureMethod 为header头部提交的数据 urlAction 实际接口地址 key 密钥数据
func Create ¶
func Create(args *ArgsCreate) (tokenID int64, errCode string, err error)
Create 创建token
func DeleteTokenByLoginFrom ¶
func DeleteTokenByLoginFrom(loginFrom string)
DeleteTokenByLoginFrom 剔除指定登录渠道的所有会话
func DeleteTokenSByTokenID ¶
DeleteTokenSByTokenID 删除tokenID对应的所有短地址
func SelectOrgAndBindID ¶
SelectOrgAndBindID 选择组织和组织成员
Types ¶
type ArgsCreate ¶
type ArgsCreate struct {
//用户ID
UserID int64 `db:"user_id" json:"userID"`
//组织ID
OrgID int64 `db:"org_id" json:"orgID"`
//组织绑定成员ID
OrgBindID int64 `db:"org_bind_id" json:"orgBindID"`
//设备ID
DeviceID int64 `db:"device_id" json:"deviceID"`
//登录渠道
LoginFrom string `db:"login_from" json:"loginFrom"`
//IP地址
IP string `db:"ip" json:"ip"`
//key
// 钥匙,用于配对
// 用户模式下,采用用户密码+SHA1计算后得出
// 设备模式下,直接使用设备的key实现
// 如果不提供,则自动生成并反馈数据
Key string `db:"key" json:"key"`
//是否记住我
// 会延长过期时间
IsRemember bool `db:"is_remember" json:"isRemember"`
}
ArgsCreate 创建token参数
type ArgsGetList ¶
type ArgsGetList struct {
//分页
Pages CoreSQLPages.ArgsDataList `json:"pages"`
//用户ID
UserID int64 `json:"userID" check:"id" empty:"true"`
//组织ID
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//组织成员ID
OrgBindID int64 `json:"orgBindID" check:"id" empty:"true"`
//设备ID
DeviceID int64 `json:"deviceID" check:"id" empty:"true"`
//登录渠道
LoginFrom string `json:"loginFrom" check:"mark" empty:"true"`
//搜索
Search string `json:"search" check:"search" empty:"true"`
}
ArgsGetList 获取列表参数
type ArgsUpdateExpire ¶
type ArgsUpdateExpire struct {
//ID
ID int64
//过期时间
// 请使用RFC3339Nano结构时间,eg: 2020-11-03T08:31:13.314Z
// JS中使用new Date().toISOString()
ExpireAt string
}
ArgsUpdateExpire 更新过期时间参数
type FieldsToken ¶
type FieldsToken struct {
//ID
ID int64 `db:"id" json:"id"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt"`
//过期时间
ExpireAt time.Time `db:"expire_at" json:"expireAt"`
//key
// 钥匙,用于配对
Key string `db:"key" json:"key"`
//用户ID
UserID int64 `db:"user_id" json:"userID"`
//组织ID
OrgID int64 `db:"org_id" json:"orgID"`
//组织绑定成员ID
OrgBindID int64 `db:"org_bind_id" json:"orgBindID"`
//设备ID
DeviceID int64 `db:"device_id" json:"deviceID"`
//登录渠道
LoginFrom string `db:"login_from" json:"loginFrom"`
//IP地址
IP string `db:"ip" json:"ip"`
//是否记住我
// 会延长过期时间
IsRemember bool `db:"is_remember" json:"isRemember"`
}
FieldsToken 会话结构体
func GetByFrom ¶
func GetByFrom(userID, deviceID int64, loginFrom string) (data FieldsToken)
GetByFrom 根据来源获取token
func GetList ¶
func GetList(args *ArgsGetList) (dataList []FieldsToken, dataCount int64, err error)
GetList 获取列表
Click to show internal directories.
Click to hide internal directories.