auth

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const XRegistryAuthHeader = "X-Registry-Auth"

XRegistryAuthHeader is the key to the encoded registry authentication configuration in an http-request header.

Variables

This section is empty.

Functions

func GetCredentials

func GetCredentials(r *http.Request) (*types.DockerAuthConfig, string, error)

GetCredentials extracts one or more DockerAuthConfigs from the request's header. The header could specify a single-auth config in which case the first return value is set. In case of a multi-auth header, the contents are stored in a temporary auth file (2nd return value). Note that the auth file should be removed after usage.

func Header(sys *types.SystemContext, authfile, username, password string) (map[string]string, error)

Header returns a map with the XRegistryAuthHeader set which can conveniently be used in the http stack.

func RemoveAuthfile

func RemoveAuthfile(authfile string)

RemoveAuthfile is a convenience function that is meant to be called in a deferred statement. If non-empty, it removes the specified authfile and log errors. It's meant to reduce boilerplate code at call sites of `GetCredentials`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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