gcp_adc

package
v1.207.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gcp_adc implements the gcp/adc authentication provider.

This provider obtains credentials from Google Cloud Application Default Credentials (ADC), which searches for credentials in this order:

  1. GOOGLE_APPLICATION_CREDENTIALS environment variable
  2. User credentials from gcloud auth application-default login
  3. Service account attached to GCP resource (GCE, Cloud Run, etc.)

Configuration example in atmos.yaml:

auth:
  providers:
    my-gcp-adc:
      kind: gcp/adc
      spec:
        project_id: my-project        # optional, defaults to ADC project
        region: us-central1           # optional
        scopes:                        # optional, defaults to cloud-platform
          - https://www.googleapis.com/auth/cloud-platform

Index

Constants

View Source
const (
	// ProviderKind is the kind identifier for this provider.
	ProviderKind = types.ProviderKindGCPADC // "gcp/adc"

	// DefaultScope is the default OAuth scope.
	DefaultScope = "https://www.googleapis.com/auth/cloud-platform"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider implements the gcp/adc authentication provider.

func New

func New(spec *types.GCPADCProviderSpec) (*Provider, error)

New creates a new ADC provider from the given spec.

func (*Provider) Authenticate

func (p *Provider) Authenticate(ctx context.Context) (types.ICredentials, error)

Authenticate obtains credentials from ADC.

func (*Provider) Environment

func (p *Provider) Environment() (map[string]string, error)

Environment returns environment variables for this provider.

func (*Provider) GetFilesDisplayPath

func (p *Provider) GetFilesDisplayPath() string

GetFilesDisplayPath returns the display path for credential files.

func (*Provider) Kind

func (p *Provider) Kind() string

Kind returns the provider kind.

func (*Provider) Logout

func (p *Provider) Logout(ctx context.Context) error

Logout removes provider-specific credential storage. ADC credentials are managed by gcloud or env; this provider does not store credentials.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name as defined in configuration.

func (*Provider) Paths

func (p *Provider) Paths() ([]types.Path, error)

Paths returns credential files/directories used by this provider. ADC uses GOOGLE_APPLICATION_CREDENTIALS or gcloud config; this provider does not manage paths.

func (*Provider) PreAuthenticate

func (p *Provider) PreAuthenticate(_ types.AuthManager) error

PreAuthenticate is a no-op for GCP ADC provider.

func (*Provider) PrepareEnvironment

func (p *Provider) PrepareEnvironment(ctx context.Context, environ map[string]string) (map[string]string, error)

PrepareEnvironment prepares environment variables for external processes. Returns a copy of environ; ADC is resolved at auth time, so no provider-specific env is required here.

func (*Provider) SetName

func (p *Provider) SetName(name string)

SetName sets the provider name (used by the factory when registering).

func (*Provider) SetRealm

func (p *Provider) SetRealm(realm string)

SetRealm satisfies the Provider interface. ADC is realm-independent because it relies on external credential sources (GOOGLE_APPLICATION_CREDENTIALS, gcloud config, or metadata server) and performs no credential file I/O. The value is stored but not used in behavior.

func (*Provider) Validate

func (p *Provider) Validate() error

Validate validates the provider configuration.

Jump to

Keyboard shortcuts

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