tokensource

package
v0.0.0-...-3ac7d67 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 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 GCPTokenSource

type GCPTokenSource struct {
	// contains filtered or unexported fields
}

func NewGCPTokenSource

func NewGCPTokenSource(ctx context.Context, client *http.Client, project, sa string, scopes []string) (*GCPTokenSource, error)

NewGCPTokenSource creates a token source for GCP access tokens.

`client` parameter is optional. If you supply your own client, you have to make sure you set the correct authentication headers yourself. If no client is given, authentication information is looked up from the environment.

func (*GCPTokenSource) Token

func (g *GCPTokenSource) Token(ctx context.Context) (*TokenResponse, error)

Token returns an access token for the configured service account and scopes.

API: https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/generateAccessToken

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
	Scope       string `json:"scope"`
	TokenType   string `json:"token_type"`
}

Jump to

Keyboard shortcuts

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