Ai
1 Star 0 Fork 0

ryancartoon/sensu-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
authentication.go 652 Bytes
一键复制 编辑 原始数据 按行查看 历史
package v2
import (
"errors"
"time"
)
// Validate returns an error if the tokens contain invalid values.
func (t *Tokens) Validate() error {
if t.Access == "" {
return errors.New("Access token cannot be empty")
}
if t.ExpiresAt == 0 {
return errors.New("Expiration must be set")
}
if t.Refresh == "" {
return errors.New("Refresh token cannot be empty")
}
return nil
}
// FixtureTokens given an access and refresh tokens returns valid tokens for use
// in tests
func FixtureTokens(accessToken, refreshToken string) *Tokens {
return &Tokens{
Access: accessToken,
ExpiresAt: time.Now().Unix(),
Refresh: refreshToken,
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryancartoon/sensu-go.git
git@gitee.com:ryancartoon/sensu-go.git
ryancartoon
sensu-go
sensu-go
v5.10.1

搜索帮助