Documentation
      ¶
    
    
  
    
  
    Overview ¶
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/" )
Variables ¶
var (
	// DefaultKeychain implements Keychain by interpreting the docker config file.
	DefaultKeychain = &defaultKeychain{}
)
    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"`
	// 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/docker/cli/cli/config/types
func Authorization ¶ added in v0.19.2
func Authorization(ctx context.Context, authn Authenticator) (*AuthConfig, error)
Authorization calls AuthorizationContext with ctx if the given Authenticator implements ContextAuthenticator, otherwise it calls Resolve with the given Resource.
func (AuthConfig) MarshalJSON ¶ added in v0.9.0
func (a AuthConfig) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*AuthConfig) UnmarshalJSON ¶ added in v0.9.0
func (a *AuthConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler
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 ContextAuthenticator ¶ added in v0.19.2
type ContextAuthenticator interface {
	// Authorization returns the value to use in an http transport's Authorization header.
	AuthorizationContext(context.Context) (*AuthConfig, error)
}
    ContextAuthenticator is like Authenticator, but allows for context to be passed in.
type ContextKeychain ¶ added in v0.19.2
type ContextKeychain interface {
	ResolveContext(context.Context, Resource) (Authenticator, error)
}
    ContextKeychain is like Keychain, but allows for context to be passed in.
type Helper ¶ added in v0.8.0
Helper is a subset of the Docker credential helper credentials.Helper interface used by NewKeychainFromHelper.
See: https://pkg.go.dev/github.com/docker/docker-credential-helpers/credentials#Helper
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.
func NewKeychainFromHelper ¶ added in v0.8.0
NewKeychainFromHelper returns a Keychain based on a Docker credential helper implementation that can Get username and password credentials for a given server URL.
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
      ¶
    
  
      
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| 
       Package github provides a keychain for the GitHub Container Registry. 
         | 
      Package github provides a keychain for the GitHub Container Registry. | 
| 
       k8schain
            module
           
          
         | 
      |
| 
       kubernetes
            module
           
          
         |