authn

package
v1.0.11 Latest Latest
Warning

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

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

Documentation

Overview

Package authn provides authentication support for registry operations. This replaces go-containerregistry's authn package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anonymous

type Anonymous struct{}

Anonymous implements Authenticator for anonymous access.

func (*Anonymous) Authorization

func (a *Anonymous) Authorization() (*AuthConfig, error)

Authorization returns empty credentials for anonymous access.

type AuthConfig

type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Auth          string `json:"auth,omitempty"`
	IdentityToken string `json:"identitytoken,omitempty"`
	RegistryToken string `json:"registrytoken,omitempty"`
}

AuthConfig contains authentication credentials.

type Authenticator

type Authenticator interface {
	// Authorization returns the authentication credentials.
	Authorization() (*AuthConfig, error)
}

Authenticator provides authentication credentials for registry operations.

func FromConfig

func FromConfig(cfg AuthConfig) Authenticator

FromConfig creates an Authenticator from an AuthConfig.

type Basic

type Basic struct {
	Username string
	Password string
}

Basic implements Authenticator for basic username/password authentication.

func (*Basic) Authorization

func (b *Basic) Authorization() (*AuthConfig, error)

Authorization returns the basic auth credentials.

type Bearer

type Bearer struct {
	Token string
}

Bearer implements Authenticator for bearer token authentication.

func NewBearer

func NewBearer(token string) *Bearer

NewBearer creates a new Bearer authenticator.

func (*Bearer) Authorization

func (b *Bearer) Authorization() (*AuthConfig, error)

Authorization returns the bearer token credentials.

type Keychain

type Keychain interface {
	// Resolve returns an Authenticator for the given resource.
	Resolve(Resource) (Authenticator, error)
}

Keychain provides a way to resolve credentials for registries.

var DefaultKeychain Keychain = &defaultKeychain{}

DefaultKeychain is the default keychain that reads from ~/.docker/config.json.

type Resource

type Resource interface {
	// RegistryStr returns the registry hostname.
	RegistryStr() string
}

Resource represents a registry resource that can be resolved for authentication.

func NewResource

func NewResource(ref reference.Reference) Resource

NewResource creates a Resource from a reference.

Jump to

Keyboard shortcuts

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