auth

package
v0.59.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 20 Imported by: 59

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuthFile

func CheckAuthFile(pathOption string) error

CheckAuthFile validates a path option, failing if the option is set but the referenced file is not accessible.

func GetDefaultAuthFile

func GetDefaultAuthFile() string

GetDefaultAuthFile returns env value REGISTRY_AUTH_FILE as default --authfile path used in multiple --authfile flag definitions Will fail over to DOCKER_CONFIG if REGISTRY_AUTH_FILE environment is not set

WARNINGS:

  • In almost all invocations, expect this function to return ""; so it can not be used for directly accessing the file.
  • Use this only for commands that _read_ credentials, not write them. The path may refer to github.com/containers auth.json, or to Docker config.json, and the distinction is lost; writing auth.json data to config.json may not be consumable by Docker, or it may overwrite and discard unrelated Docker configuration set by the user.

func GetLoginFlags

func GetLoginFlags(flags *LoginOptions) *pflag.FlagSet

GetLoginFlags defines and returns login flags for containers tools

func GetLoginFlagsCompletions added in v0.23.0

func GetLoginFlagsCompletions() completion.FlagCompletions

GetLoginFlagsCompletions returns the FlagCompletions for the login flags

func GetLogoutFlags

func GetLogoutFlags(flags *LogoutOptions) *pflag.FlagSet

GetLogoutFlags defines and returns logout flags for containers tools

func GetLogoutFlagsCompletions added in v0.23.0

func GetLogoutFlagsCompletions() completion.FlagCompletions

GetLogoutFlagsCompletions returns the FlagCompletions for the logout flags

func Login

func Login(ctx context.Context, systemContext *types.SystemContext, opts *LoginOptions, args []string) error

Login implements a “log in” command with the provided opts and args reading the password from opts.Stdin or the options in opts.

func Logout

func Logout(systemContext *types.SystemContext, opts *LogoutOptions, args []string) error

Logout implements a “log out” command with the provided opts and args

Types

type ErrNewCredentialsInvalid added in v0.51.1

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

ErrNewCredentialsInvalid means that the new user-provided credentials are not accepted by the registry.

func (ErrNewCredentialsInvalid) Error added in v0.51.1

func (e ErrNewCredentialsInvalid) Error() string

Error returns the error message as a string.

func (ErrNewCredentialsInvalid) Unwrap added in v0.51.1

func (e ErrNewCredentialsInvalid) Unwrap() error

Unwrap returns the underlying error.

type LoginOptions

type LoginOptions struct {
	// CLI flags managed by the FlagSet returned by GetLoginFlags
	// Callers that use GetLoginFlags should not need to touch these values at all; callers that use
	// other CLI frameworks should set them based on user input.
	AuthFile             string
	DockerCompatAuthFile string
	CertDir              string
	Password             string
	Username             string
	StdinPassword        bool
	GetLoginSet          bool
	Verbose              bool // set to true for verbose output
	AcceptRepositories   bool // set to true to allow namespaces or repositories rather than just registries
	// Options caller can set
	Stdin                     io.Reader // set to os.Stdin
	Stdout                    io.Writer // set to os.Stdout
	AcceptUnspecifiedRegistry bool      // set to true if allows login with unspecified registry
	NoWriteBack               bool      // set to true to not write the credentials to the authfile/cred helpers
}

LoginOptions represents common flags in login In addition, the caller should probably provide a --tls-verify flag (that affects the provided *types.SystemContest)

type LogoutOptions

type LogoutOptions struct {
	// CLI flags managed by the FlagSet returned by GetLogoutFlags
	// Callers that use GetLogoutFlags should not need to touch these values at all; callers that use
	// other CLI frameworks should set them based on user input.
	AuthFile             string
	DockerCompatAuthFile string
	All                  bool
	AcceptRepositories   bool // set to true to allow namespaces or repositories rather than just registries
	// Options caller can set
	Stdout                    io.Writer // set to os.Stdout
	AcceptUnspecifiedRegistry bool      // set to true if allows logout with unspecified registry
}

LogoutOptions represents the results for flags in logout

Jump to

Keyboard shortcuts

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