tokenorchestrator

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTokenOrchestrator

type BaseTokenOrchestrator struct {
	ClientConfig *oauth.Config
	TokenCache   cache.TokenCache
}

BaseTokenOrchestrator implements the main logic to initiate device authorization flow

func NewBaseTokenOrchestrator

func NewBaseTokenOrchestrator(ctx context.Context, tokenCache cache.TokenCache, authClient service.AuthMetadataServiceClient) (BaseTokenOrchestrator, error)

func (BaseTokenOrchestrator) FetchTokenFromCacheOrRefreshIt

func (t BaseTokenOrchestrator) FetchTokenFromCacheOrRefreshIt(ctx context.Context, tokenRefreshGracePeriod config.Duration) (token *oauth2.Token, err error)

FetchTokenFromCacheOrRefreshIt fetches the token from cache and refreshes it if it'll expire within the Config.TokenRefreshGracePeriod period.

func (BaseTokenOrchestrator) RefreshToken

func (t BaseTokenOrchestrator) RefreshToken(ctx context.Context, token *oauth2.Token) (*oauth2.Token, error)

RefreshToken attempts to refresh the access token if a refresh token is provided.

Jump to

Keyboard shortcuts

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