package authn
import "github.com/google/go-containerregistry/pkg/authn"
Package authn defines different methods of authentication for talking to a container registry.
Index ¶
Constants ¶
const ( // DefaultAuthKey is the key used for dockerhub in config files, which // is hardcoded for historical reasons. DefaultAuthKey = "https://" + name.DefaultRegistry + "/v1/" )
Types ¶
type AuthConfig ¶
type AuthConfig struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Auth string `json:"auth,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 Inlined what we use from github.com/cli/cli/config/types
type Authenticator ¶
type Authenticator interface { // Authorization returns the value to use in an http transport's Authorization header. Authorization() (*AuthConfig, error) }
Authenticator is used to authenticate Docker transports.
var Anonymous Authenticator = &anonymous{}
Anonymous is a singleton Authenticator for providing anonymous auth.
func FromConfig ¶
func FromConfig(cfg AuthConfig) Authenticator
FromConfig returns an Authenticator that just returns the given AuthConfig.
type Basic ¶
Basic implements Authenticator for basic authentication.
func (*Basic) Authorization ¶
func (b *Basic) Authorization() (*AuthConfig, error)
Authorization implements Authenticator.
type Bearer ¶
type Bearer struct { Token string `json:"token"` }
Bearer implements Authenticator for bearer authentication.
func (*Bearer) Authorization ¶
func (b *Bearer) Authorization() (*AuthConfig, error)
Authorization implements Authenticator.
type Keychain ¶
type Keychain interface { // Resolve looks up the most appropriate credential for the specified target. Resolve(Resource) (Authenticator, error) }
Keychain is an interface for resolving an image reference to a credential.
var ( // DefaultKeychain implements Keychain by interpreting the docker config file. DefaultKeychain Keychain = &defaultKeychain{} )
func NewMultiKeychain ¶
NewMultiKeychain composes a list of keychains into one new keychain.
type Resource ¶
type Resource interface { // String returns the full string representation of the target, e.g. // gcr.io/my-project or just gcr.io. String() string // RegistryStr returns just the registry portion of the target, e.g. for // gcr.io/my-project, this should just return gcr.io. This is needed to // pull out an appropriate hostname. RegistryStr() string }
Resource represents a registry or repository that can be authenticated against.
Source Files ¶
anon.go auth.go authn.go basic.go bearer.go doc.go keychain.go multikeychain.go
Directories ¶
Path | Synopsis |
---|---|
pkg/authn/k8schain | Package k8schain exposes an implementation of the authn.Keychain interface based on the semantics the Kubelet follows when pulling the images for a Pod in Kubernetes. |
pkg/authn/k8schain/tests | |
pkg/authn/k8schain/tests/explicit | |
pkg/authn/k8schain/tests/implicit | |
pkg/authn/k8schain/tests/noauth | |
pkg/authn/k8schain/tests/serviceaccount |
- Version
- v0.1.2
- Published
- Aug 21, 2020
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 4 seconds ago –
Tools for package owners.