oauth1

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 Transport

type Transport struct {
	// Consumer Key
	ConsumerKey string

	// Consumer Private Key
	PrivateKey *rsa.PrivateKey

	// Source supplies the Token to add to the request
	// Authorization headers.
	Source scm.TokenSource

	// Base is the base RoundTripper used to make requests.
	// If nil, http.DefaultTransport is used.
	Base http.RoundTripper
	// contains filtered or unexported fields
}

Transport is an http.RoundTripper that refreshes oauth tokens, wrapping a base RoundTripper and refreshing the token if expired.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip authorizes and authenticates the request with an access token from the request context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL