1 Star 0 Fork 0

h79 / gothird

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
structs.go 2.02 KB
一键复制 编辑 原始数据 按行查看 历史
huqiuyun 提交于 2023-09-12 20:06 . 上传素材
package app3
import (
"gitee.com/h79/gothird/token/access"
)
type PreAuthCode struct {
Code string `json:"pre_auth_code"`
ExpiresIn int64 `json:"expires_in"`
}
// Info 获取授权方的帐号基本信息
type Info struct {
Info map[string]interface{} `json:"authorizer_info"`
}
type Authorization struct {
Appid string `json:"authorizer_appid"`
AccessToken string `json:"authorizer_access_token"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"authorizer_refresh_token"`
}
type FuncInfo struct {
Func []interface{} `json:"func_info"`
}
type AInfo struct {
Authorization
FuncInfo
}
type AuthorizationInfo struct {
Info AInfo `json:"authorization_info"`
}
// GetAccessToken access.Token interface implement
func (a AuthorizationInfo) GetAccessToken() access.Value {
return access.Value{
Data: a.Info.AccessToken,
ExpireIn: access.ExpireSecond(a.Info.ExpiresIn),
}
}
func (a AuthorizationInfo) GetRefAccessToken() access.Value {
return access.Value{
Data: a.Info.RefreshToken,
ExpireIn: access.RefExpireSecond(0),
}
}
type ListAuthInfo struct {
TotalCount int `json:"total_count"`
List []Auth `json:"list"`
}
type Auth struct {
AuthorizerAppId string `json:"authorizer_appid"`
AuthorizerRefreshToken string `json:"refresh_token"`
AuthTime int64 `json:"auth_time"`
}
type AuthorizerToken struct {
AuthorizerAppId string `json:"authorizer_appid,omitempty"`
AcsToken string `json:"authorizer_access_token"`
ExpireIn int64 `json:"expires_in"`
RefToken string `json:"authorizer_refresh_token"`
RefExpireIn int64 `json:"authorizer_refresh_expires_in,omitempty"`
}
// GetAccessToken access.Token interface implement
func (a AuthorizerToken) GetAccessToken() access.Value {
return access.Value{
Data: a.AcsToken,
ExpireIn: access.ExpireSecond(a.ExpireIn),
}
}
func (a AuthorizerToken) GetRefAccessToken() access.Value {
return access.Value{
Data: a.RefToken,
ExpireIn: access.RefExpireSecond(a.RefExpireIn),
}
}
1
https://gitee.com/h79/gothird.git
git@gitee.com:h79/gothird.git
h79
gothird
gothird
v1.8.103

搜索帮助