authn

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Overview

Package authn implements the logic for authentication with OCI registries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(hostname, user, token string) error

Login to remote registry. For now, only support login with token.

func Logout

func Logout(hostname string) error

Logout from remote registry.

func NewClient

func NewClient(options ...func(*Options)) remote.Client

NewClient creates a new authenticated client to interact with a remote registry.

func WithClientCredentials

func WithClientCredentials(cred *clientcredentials.Config) func(c *Options)

WithClientCredentials sets the client ID, client secret, token URL and scopes for OAuth2.0 client.

func WithCredentials

func WithCredentials(cred *auth.Credential) func(c *Options)

WithCredentials sets the credentials for the client.

func WithOauth

func WithOauth(ctx context.Context, oauth bool) func(c *Options)

WithOauth is used to enable OAuth2.0 Options Credentials flow.

Types

type Options

type Options struct {
	Ctx               context.Context
	Credentials       *auth.Credential
	Oauth             bool
	ClientCredentials *clientcredentials.Config
}

Options used for the HTTP client that can authenticate with auth.Credentials or via OAuth2.0 Options Credentials flow.

type Store

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

Store provides credential CRUD operations.

func NewStore

func NewStore(configPaths ...string) (*Store, error)

NewStore generates a store based on the passed in config file path.

func (*Store) Credential

func (s *Store) Credential(_ context.Context, registry string) (auth.Credential, error)

Credential iterates all the config files, returns the first non-empty credential in a best-effort way.

func (*Store) Erase

func (s *Store) Erase(registry string) error

Erase erases a credential for a given registry.

func (*Store) Store

func (s *Store) Store(registry string, cred auth.Credential) error

Store stores a credential for a given registry.

Jump to

Keyboard shortcuts

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