1 Star 0 Fork 0

yangx282441848/scm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
token.go 826 Bytes
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2018 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package scm
import (
"context"
"time"
)
type (
// Token represents the credentials used to authorize
// the requests to access protected resources.
Token struct {
Token string
Refresh string
Expires time.Time
}
// TokenSource returns a token.
TokenSource interface {
Token(context.Context) (*Token, error)
}
// TokenKey is the key to use with the context.WithValue
// function to associate an Token value with a context.
TokenKey struct{}
)
// WithContext returns a copy of parent in which the token value is set
func WithContext(parent context.Context, token *Token) context.Context {
return context.WithValue(parent, TokenKey{}, token)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangx282441848/scm.git
git@gitee.com:yangx282441848/scm.git
yangx282441848
scm
scm
v1.16.14

搜索帮助

0d507c66 1850385 C8b1a773 1850385