registryauth

package
v1.234.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package registryauth binds OCI registry access to the existing Atmos auth lifecycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(ctx context.Context, config *schema.AtmosConfiguration, identity, host string, options ...Option) (authn.Authenticator, error)

Authenticate logs in the selected identity and performs its registry exchange.

func Identity

func Identity(config *schema.AtmosConfiguration, host string) (string, error)

Identity resolves an exact normalized host to its configured Atmos identity.

func Logout

func Logout(ctx context.Context, config *schema.AtmosConfiguration, identity string, options ...Option) error

Logout clears the selected identity through Atmos auth, including integration cleanup.

func PluginBindings

func PluginBindings(config *schema.AtmosConfiguration) (map[string]string, error)

Types

type Manager

type Manager interface {
	Authenticate(context.Context, string) (*types.WhoamiInfo, error)
	GetCachedCredentials(context.Context, string) (*types.WhoamiInfo, error)
	Logout(context.Context, string, bool) error
}

Manager is the authentication lifecycle needed by registry access.

type Option

type Option func(*Resolver)

Option configures lazy authentication dependencies.

func WithPreparation

func WithPreparation(prepare Preparation) Option

WithPreparation supplies the plugin composition boundary without introducing a dependency cycle.

type Preparation

type Preparation func(context.Context) (func(), error)

Preparation registers already available auth plugins without downloading packages. The returned function removes those temporary registrations after authentication.

type RegistryCredentials

type RegistryCredentials interface {
	RegistryHost() string
	RegistryAuth() (username, password, identityToken, registryToken string)
}

RegistryCredentials supplies credentials scoped to one registry host. Auth identities can implement this without depending on an OCI client.

type Resolver

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

Resolver authenticates only exact configured hosts. Exchanged tokens are cached briefly against the live auth session; logout or rotation invalidates that cache.

func New

func New(config *schema.AtmosConfiguration, bindings map[string]string, options ...Option) *Resolver

New creates a resolver without loading credentials or starting authentication.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, resource authn.Resource) (authn.Authenticator, bool, error)

Resolve authenticates explicitly bound hosts and leaves other hosts to the caller. A configured identity's failure is terminal, never an ambient-credential fallback.

Jump to

Keyboard shortcuts

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