代码拉取完成,页面将自动刷新
package token
import "context"
const (
AppName = "token"
)
type Service interface {
// 登录接口(颁发Token)
Login(context.Context, *LoginRequest) (*Token, error)
// 退出接口(销毁Token)
Logout(context.Context, *LogoutRequest) error
// 校验Token 是给内部中间层使用 身份校验层
// 校验完后返回Token, 通过Token获取 用户信息
ValiateToken(context.Context, *ValiateToken) (*Token, error)
}
func NewLoginRequest() *LoginRequest {
return &LoginRequest{}
}
type LoginRequest struct {
Username string
Password string
}
// 万一的Token泄露, 不知道refresh_token,也没法推出
type LogoutRequest struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
}
func NewValiateToken(at string) *ValiateToken {
return &ValiateToken{
AccessToken: at,
}
}
type ValiateToken struct {
AccessToken string `json:"access_token"`
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。