tokenprovider

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(tokenProvider TokenProvider) httpclient.Middleware

Types

type Config

type Config struct {
	RoutePath         string
	RouteMethod       string
	DataSourceID      int64
	DataSourceUpdated time.Time
	Scopes            []string

	// JwtTokenConfig is only used for JWT tokens
	JwtTokenConfig *JwtTokenConfig
}

Config is the configuration for getting a TokenProvider.

type JwtTokenConfig

type JwtTokenConfig struct {
	Email      string
	PrivateKey []byte
	URI        string
}

JwtTokenConfig is the configuration for using JWT to fetch tokens.

type TokenProvider

type TokenProvider interface {
	GetAccessToken(context.Context) (string, error)
}

TokenProvider is anything that can return a token

func NewGceAccessTokenProvider

func NewGceAccessTokenProvider(cfg Config) TokenProvider

NewGceAccessTokenProvider returns a token provider for gce authentication

func NewJwtAccessTokenProvider

func NewJwtAccessTokenProvider(cfg Config) TokenProvider

NewJwtAccessTokenProvider returns a token provider for jwt file authentication

Jump to

Keyboard shortcuts

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