authprovider

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAuthProviderName string = "dockerConfig"
View Source
const DefaultDockerAuthTTL = 1 * time.Hour

Variables

This section is empty.

Functions

func GetRegistryHostName

func GetRegistryHostName(artifact string) (string, error)

func Register

func Register(name string, factory AuthProviderFactory)

Register adds the factory to the built in providers map

Types

type AuthConfig

type AuthConfig struct {
	Username      string
	Password      string
	IdentityToken string
	Email         string
	Provider      AuthProvider `json:"-"` // Provider is not serialized
	ExpiresOn     time.Time
}

This config represents the credentials that should be used when pulling artifacts from specific repositories.

type AuthProvider

type AuthProvider interface {
	// Enabled returns true if the config provider is properly enabled
	// It will verify necessary values provided in config file to
	// create the AuthProvider
	Enabled(ctx context.Context) bool
	// Provide returns AuthConfig for registry.
	Provide(ctx context.Context, artifact string) (AuthConfig, error)
}

func CreateAuthProviderFromConfig

func CreateAuthProviderFromConfig(authProviderConfig AuthProviderConfig) (AuthProvider, error)

CreateAuthProvidersFromConfig creates the AuthProvider from the provided configuration. If the AuthProviderConfig isn't specified, use the default auth provider

type AuthProviderConfig

type AuthProviderConfig map[string]interface{} //nolint:revive // ignore linter to have unique type name

AuthProviderConfig represents the configuration of an AuthProvider

type AuthProviderFactory

type AuthProviderFactory interface {
	Create(authProviderConfig AuthProviderConfig) (AuthProvider, error)
}

AuthProviderFactory is an interface that defines methods to create an AuthProvider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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