加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
manage.go 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Lyric 提交于 2018-09-04 17:17 . remove inject
package oauth2
import (
"net/http"
"time"
)
// TokenGenerateRequest provide to generate the token request parameters
type TokenGenerateRequest struct {
ClientID string
ClientSecret string
UserID string
RedirectURI string
Scope string
Code string
Refresh string
AccessTokenExp time.Duration
Request *http.Request
}
// Manager authorization management interface
type Manager interface {
// get the client information
GetClient(clientID string) (cli ClientInfo, err error)
// generate the authorization token(code)
GenerateAuthToken(rt ResponseType, tgr *TokenGenerateRequest) (authToken TokenInfo, err error)
// generate the access token
GenerateAccessToken(rt GrantType, tgr *TokenGenerateRequest) (accessToken TokenInfo, err error)
// refreshing an access token
RefreshAccessToken(tgr *TokenGenerateRequest) (accessToken TokenInfo, err error)
// use the access token to delete the token information
RemoveAccessToken(access string) (err error)
// use the refresh token to delete the token information
RemoveRefreshToken(refresh string) (err error)
// according to the access token for corresponding token information
LoadAccessToken(access string) (ti TokenInfo, err error)
// according to the refresh token for corresponding token information
LoadRefreshToken(refresh string) (ti TokenInfo, err error)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化