1 Star 0 Fork 0

h79/goutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
auth.go 695 Bytes
一键复制 编辑 原始数据 按行查看 历史
huqiuyun 提交于 2022-07-26 14:39 . 认证加一个接口
package token
type Token interface {
WithSession(session Session) Token
WithExtend(extend string) Token
GetSession() Session
GetExtend() string
GetToken() string
Update() (string, error)
}
type Authenticate interface {
Type() string
Create(source Source, expireSeconds int64) (Token, error)
Decode(source Source, token string) (Token, error)
Check(source Source, token string) (Token, error)
// EnableFlag return 0= disable, 1=enable, 2=not exist
EnableFlag(source Source) int
SetEnabled(source Source, enable bool)
}
type Route interface {
HasAuth(method string) bool
Auth() Authenticate
Use(a Authenticate) Route
}
type Engine interface {
Client() Route
Server() Route
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/h79/goutils.git
git@gitee.com:h79/goutils.git
h79
goutils
goutils
v1.1.24

搜索帮助