oauth2

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

func (*Refresher) Refresh

func (t *Refresher) Refresh(token *scm.Token) error

Refresh refreshes the expired token.

func (*Refresher) Token

func (t *Refresher) Token(ctx context.Context) (*scm.Token, error)

Token returns a token. If the token is missing or expired, the token is refreshed.

Jump to

Keyboard shortcuts

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