...

Package impersonate

import "google.golang.org/api/internal/impersonate"
Overview
Index

Overview ▾

Package impersonate is used to impersonate Google Credentials.

func TokenSource

func TokenSource(ctx context.Context, ts oauth2.TokenSource, config *Config) (oauth2.TokenSource, error)

TokenSource returns an impersonated TokenSource configured with the provided config using ts as the base credential provider for making requests.

type Config

Config for generating impersonated credentials.

type Config struct {
    // Target is the service account to impersonate. Required.
    Target string
    // Scopes the impersonated credential should have. Required.
    Scopes []string
    // Delegates are the service accounts in a delegation chain. Each service
    // account must be granted roles/iam.serviceAccountTokenCreator on the next
    // service account in the chain. Optional.
    Delegates []string
}