auth

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 8 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

func EnvKeychain

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

EnvKeychain 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 InMemoryKeychain added in v0.10.0

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

InMemoryKeychain 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 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 ResolvedKeychain added in v0.10.0

type ResolvedKeychain struct {
	Auths map[string]string
}

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