auth

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const EnvRegistryAuth = "CNB_REGISTRY_AUTH"

Variables

This section is empty.

Functions

func BuildEnvVar

func BuildEnvVar(keychain authn.Keychain, images ...string) (string, error)

BuildEnvVar creates the contents to use for authentication environment variable.

Complementary to `ReadEnvVar`.

func DefaultKeychain added in v0.10.0

func DefaultKeychain(images ...string) (authn.Keychain, error)

DefaultKeychain returns a keychain containing authentication configuration for the given images from the following sources, if they exist, in order of precedence: the provided environment variable the docker config.json file credential helpers for Amazon and Azure

func NewEnvKeychain added in v0.14.1

func NewEnvKeychain(envVar string) (authn.Keychain, error)

NewEnvKeychain returns an authn.Keychain that uses the provided environment variable as a source of credentials. The value of the environment variable should be a JSON object that maps OCI registry hostnames to Authorization headers.

func NewResolvedKeychain added in v0.14.1

func NewResolvedKeychain(keychain authn.Keychain, images ...string) authn.Keychain

NewResolvedKeychain resolves credentials for the given images from the given keychain and returns a new keychain that stores the pre-resolved credentials in memory and returns them on demand. This is useful in cases where the backing credential store may become inaccessible in the future.

func ReadEnvVar

func ReadEnvVar(envVar string) (map[string]string, error)

ReadEnvVar parses an environment variable to produce a map of 'registry url' to 'authorization header'.

Complementary to `BuildEnvVar`.

Example Input:

{"gcr.io": "Bearer asdf=", "docker.io": "Basic qwerty="}

Example Output:

gcr.io -> Bearer asdf=
docker.io -> Basic qwerty=

func ReferenceForRepoName

func ReferenceForRepoName(keychain authn.Keychain, ref string) (name.Reference, authn.Authenticator, error)

ReferenceForRepoName returns a reference and an authenticator for a given image name and keychain.

Types

type EnvKeychain

type EnvKeychain struct {
	AuthHeaders map[string]string
}

EnvKeychain is an implementation of authn.Keychain that stores credentials as auth headers.

func (*EnvKeychain) Resolve added in v0.7.5

func (k *EnvKeychain) Resolve(resource authn.Resource) (authn.Authenticator, error)

type ResolvedKeychain added in v0.10.0

type ResolvedKeychain struct {
	AuthConfigs map[string]*authn.AuthConfig
}

ResolvedKeychain is an implementation of authn.Keychain that stores credentials in memory.

func (*ResolvedKeychain) Resolve added in v0.10.0

func (k *ResolvedKeychain) Resolve(resource authn.Resource) (authn.Authenticator, error)

Jump to

Keyboard shortcuts

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