credentials

package
v0.19.1221 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(ctx context.Context, cfg *Config, logger *zap.Logger) (azcore.TokenCredential, error)

Fetch returns a credential for cfg.

When cfg names an app registration with a secret or certificate, that is used — it is the only way to authenticate into a tenant this process has no identity in, which is what reaching a vendor's registry requires.

Otherwise it falls back to the ambient identity via NewDefaultAzureCredential: on an Azure VM that is the identity assigned to the VM, and locally it is whatever you are logged in as. A nil cfg selects the ambient path, so callers with no credential to offer can keep passing nil. For more information, see: https://learn.microsoft.com/en-us/azure/developer/go/sdk/authentication/authentication-overview

func FetchEnv

func FetchEnv(ctx context.Context, cfg *Config) (map[string]string, error)

Types

type Config

type Config struct {
	ServicePrincipal *ServicePrincipalCredentials `` /* 160-byte string literal not displayed */
	UseDefault       bool                         `` /* 136-byte string literal not displayed */

	// ManagedIdentityClientID runs the operation as a specific user-assigned
	// managed identity instead of the VM's system identity.
	ManagedIdentityClientID string `` /* 211-byte string literal not displayed */

	// The fields below authenticate as an app registration in someone else's
	// tenant — a vendor's registry, reached from a control plane that holds no
	// identity there. Managed identity cannot cross a tenant boundary, so this
	// is the only path for that case.
	//
	// They are deliberately unserializable. A Config travels inside plans and
	// Temporal history; ClientSecret and ClientCertificatePEM are long-lived
	// vendor credentials that must not. Resolve them, mint a short-lived
	// registry token, and send that instead (see EnsureACRAuth). The blank
	// tags are what make an accidental send drop the material rather than
	// leak it.
	TenantID             string `cty:"-" hcl:"-" mapstructure:"-" json:"-" temporaljson:"-"`
	ClientID             string `cty:"-" hcl:"-" mapstructure:"-" json:"-" temporaljson:"-"`
	ClientSecret         string `cty:"-" hcl:"-" mapstructure:"-" json:"-" temporaljson:"-"`
	ClientCertificatePEM []byte `cty:"-" hcl:"-" mapstructure:"-" json:"-" temporaljson:"-"`
}

func (Config) HasAppRegistrationCredentials added in v0.19.1153

func (c Config) HasAppRegistrationCredentials() bool

HasAppRegistrationCredentials reports whether this config carries material for a specific app registration, as opposed to relying on whatever ambient identity the process happens to have.

func (Config) String

func (c Config) String() string

type ServicePrincipalCredentials

type ServicePrincipalCredentials struct {
	SubscriptionID       string `` /* 138-byte string literal not displayed */
	SubscriptionTenantID string `` /* 173-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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