credentialprovider

package
v0.1.50 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Extracted from k8s.io/pkg/credentialprovider/config.go

Extracted from k8s.io/pkg/credentialprovider/keyring.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Auth     string `json:"auth,omitempty"`

	// Email is an optional value associated with the username.
	// This field is deprecated and will be removed in a later
	// version of docker.
	Email string `json:"email,omitempty"`

	ServerAddress string `json:"serveraddress,omitempty"`

	// IdentityToken is used to authenticate the user and get
	// an access token for the registry.
	IdentityToken string `json:"identitytoken,omitempty"`

	// RegistryToken is a bearer token to be sent to a registry
	RegistryToken string `json:"registrytoken,omitempty"`
}

AuthConfig contains authorization information for connecting to a Registry This type mirrors "github.com/docker/docker/api/types.AuthConfig"

type BasicDockerKeyring

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

BasicDockerKeyring is a trivial map-backed implementation of DockerKeyring

func (*BasicDockerKeyring) Add

func (dk *BasicDockerKeyring) Add(cfg DockerConfig)

Add add some docker config in basic docker keyring

func (*BasicDockerKeyring) Lookup

func (dk *BasicDockerKeyring) Lookup(image string) ([]AuthConfig, bool)

Lookup implements the DockerKeyring method for fetching credentials based on image name. Multiple credentials may be returned if there are multiple potentially valid credentials available. This allows for rotation.

type DockerConfig

type DockerConfig map[string]DockerConfigEntry

DockerConfig represents the config file used by the docker CLI. This config that represents the credentials that should be used when pulling images from specific image repositories.

func ReadDockerConfigJSONFileFromBytes

func ReadDockerConfigJSONFileFromBytes(contents []byte) (cfg DockerConfig, err error)

func ReadSpecificDockerConfigJSONFile

func ReadSpecificDockerConfigJSONFile(filePath string) (cfg DockerConfig, err error)

ReadSpecificDockerConfigJSONFile attempts to read docker configJSON from a given file path.

type DockerConfigEntry

type DockerConfigEntry struct {
	Username string
	Password string
	Email    string
}

DockerConfigEntry wraps a docker config as a entry

func (*DockerConfigEntry) UnmarshalJSON

func (ident *DockerConfigEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type DockerConfigJSON

type DockerConfigJSON struct {
	Auths DockerConfig `json:"auths"`
	// +optional
	HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"`
}

DockerConfigJSON represents ~/.docker/config.json file info see https://github.com/docker/docker/pull/12009

type DockerKeyring

type DockerKeyring interface {
	Lookup(image string) ([]AuthConfig, bool)
}

DockerKeyring tracks a set of docker registry credentials, maintaining a reverse index across the registry endpoints. A registry endpoint is made up of a host (e.g. registry.example.com), but it may also contain a path (e.g. registry.example.com/foo) This index is important for two reasons:

  • registry endpoints may overlap, and when this happens we must find the most specific match for a given image
  • iterating a map does not yield predictable results

type FakeKeyring

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

FakeKeyring a fake config credentials

func (*FakeKeyring) Lookup

func (f *FakeKeyring) Lookup(image string) ([]AuthConfig, bool)

Lookup implements the DockerKeyring method for fetching credentials based on image name return fake auth and ok

type UnionDockerKeyring

type UnionDockerKeyring []DockerKeyring

UnionDockerKeyring delegates to a set of keyrings.

func (UnionDockerKeyring) Lookup

func (k UnionDockerKeyring) Lookup(image string) ([]AuthConfig, bool)

Lookup implements the DockerKeyring method for fetching credentials based on image name. return each credentials

Jump to

Keyboard shortcuts

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