Help us shape the future of Go! Take the 2026 Go Developer Survey

auth

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotLoggedIn = errors.New("not logged in")
)

Common errors

Functions

This section is empty.

Types

type Client

type Client interface {
	// Login logs in to a remote server identified by the hostname.
	// Deprecated: use LoginWithOpts
	Login(ctx context.Context, hostname, username, secret string, insecure bool) error
	// LoginWithOpts logs in to a remote server identified by the hostname with custom options
	LoginWithOpts(options ...LoginOption) error
	// Logout logs out from a remote server identified by the hostname.
	Logout(ctx context.Context, hostname string) error
	// Resolver returns a new authenticated resolver.
	// Deprecated: use ResolverWithOpts
	Resolver(ctx context.Context, client *http.Client, plainHTTP bool) (remotes.Resolver, error)
	// ResolverWithOpts returns a new authenticated resolver with custom options.
	ResolverWithOpts(options ...ResolverOption) (remotes.Resolver, error)
}

Client provides authentication operations for remotes.

type LoginOption

type LoginOption func(*LoginSettings)

LoginOption allows specifying various settings on login.

func WithLoginContext

func WithLoginContext(context context.Context) LoginOption

WithLoginContext returns a function that sets the Context setting on login.

func WithLoginHostname

func WithLoginHostname(hostname string) LoginOption

WithLoginHostname returns a function that sets the Hostname setting on login.

func WithLoginInsecure

func WithLoginInsecure() LoginOption

WithLoginInsecure returns a function that sets the Insecure setting to true on login.

func WithLoginSecret

func WithLoginSecret(secret string) LoginOption

WithLoginSecret returns a function that sets the Secret setting on login.

func WithLoginTLS

func WithLoginTLS(certFile, keyFile, caFile string) LoginOption

WithLoginTLS returns a function that sets the tls settings on login.

func WithLoginUserAgent

func WithLoginUserAgent(userAgent string) LoginOption

WithLoginUserAgent returns a function that sets the UserAgent setting on login.

func WithLoginUsername

func WithLoginUsername(username string) LoginOption

WithLoginUsername returns a function that sets the Username setting on login.

type LoginSettings

type LoginSettings struct {
	Context   context.Context
	Hostname  string
	Username  string
	Secret    string
	CertFile  string
	KeyFile   string
	CAFile    string
	Insecure  bool
	UserAgent string
}

LoginSettings represent all the various settings on login.

type ResolverOption

type ResolverOption func(*ResolverSettings)

ResolverOption allows specifying various settings on the resolver.

func WithResolverClient

func WithResolverClient(client *http.Client) ResolverOption

WithResolverClient returns a function that sets the Client setting on resolver.

func WithResolverHeaders

func WithResolverHeaders(headers http.Header) ResolverOption

WithResolverHeaders returns a function that sets the Headers setting on resolver.

func WithResolverPlainHTTP

func WithResolverPlainHTTP() ResolverOption

WithResolverPlainHTTP returns a function that sets the PlainHTTP setting to true on resolver.

type ResolverSettings

type ResolverSettings struct {
	Client    *http.Client
	PlainHTTP bool
	Headers   http.Header
}

ResolverSettings represent all the various settings on a resolver.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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