Documentation ¶
Index ¶
Constants ¶
const ( SchemeBearer = "Bearer" SchemeToken = "token" )
Supported authentication schemes. Note that Gogs and Gitea use non-standard authorization schemes.
Variables ¶
This section is empty.
Functions ¶
func ContextTokenSource ¶
func ContextTokenSource() scm.TokenSource
ContextTokenSource returns a TokenSource that returns a token from the http.Request context.
func StaticTokenSource ¶
func StaticTokenSource(t *scm.Token) scm.TokenSource
StaticTokenSource returns a TokenSource that always returns the same token. Because the provided token t is never refreshed, StaticTokenSource is only useful for tokens that never expire.
Types ¶
type Refresher ¶
type Refresher struct { ClientID string ClientSecret string Endpoint string Source scm.TokenSource Client *http.Client }
Refresher is an http.RoundTripper that refreshes oauth tokens, wrapping a base RoundTripper and refreshing the token if expired.
IMPORTANT the Refresher is NOT safe for concurrent use by multiple goroutines.
type Transport ¶
type Transport struct { Scheme string Source scm.TokenSource Base http.RoundTripper }
Transport is an http.RoundTripper that refreshes oauth tokens, wrapping a base RoundTripper and refreshing the token if expired.