tokensource

package
v0.0.0-...-d96932d Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 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, 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. `defaultSAName` specifies the GCP IAM service accoutn name to use if no dedicated service account is configurred on the key.

func (*GCPTokenSource) Token

func (g *GCPTokenSource) Token(ctx context.Context, saName, saDelegateName string) (*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