Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReactiveTokenSource ¶
type ReactiveTokenSource struct {
// contains filtered or unexported fields
}
ReactiveTokenSource is a TokenSource that holds a single token in memory and validates its expiry before each call to retrieve it with Token. If it's expired, it will be auto-refreshed using the new TokenSource and onUpdate callback will be called with new token.
func NewReactiveTokenSource ¶
func NewReactiveTokenSource( tokenSourceFactory TokenSourceFactory, t *oauth2.Token, onUpdate func(ctx context.Context, t *oauth2.Token), ) *ReactiveTokenSource
NewReactiveTokenSource returns a ReactiveTokenSource which repeatedly returns the same token as long as it's valid, starting with t. When its cached token is invalid, a new token is obtained from src and onUpdate callback is called.
type TokenSourceFactory ¶
type Transport ¶
type Transport struct { // Source supplies the token to add to outgoing requests' // Authorization headers. Source TokenSource // Base is the base RoundTripper used to make HTTP requests. // If nil, http.DefaultTransport is used. Base http.RoundTripper // contains filtered or unexported fields }
Transport is an http.RoundTripper that makes OAuth 2.0 HTTP requests, wrapping a base RoundTripper and adding an Authorization header with a token from the supplied Sources.
Transport is a low-level mechanism. Most code will use the higher-level Config.Client method instead.
func (*Transport) CancelRequest ¶
CancelRequest cancels an in-flight request by closing its connection.