httpauth

package
v0.0.0-...-a078c60 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// SetAuth sets authentication on the request.
	//
	// Returns true if authentication successfully set.
	// Does nothing and returns false if no authentication available for the given request.
	// Does nothing and returns false if the request scheme is not https.
	SetAuth(envContainer app.EnvContainer, request *http.Request) (bool, error)
}

Authenticator adds authentication to request.

This could be instead replaced with a http.RoundTripper workflow, however this means we have to use the same http.Client, and we generally pass EnvContainers to functions right now, and not building objects with EnvContainers, so this would not fit in with the rest of this codebase. This should be re-evaluated though.

func NewEnvAuthenticator

func NewEnvAuthenticator(usernameKey string, passwordKey string) Authenticator

NewEnvAuthenticator returns a new env Authenticator for the environment.

func NewMultiAuthenticator

func NewMultiAuthenticator(authenticators ...Authenticator) Authenticator

NewMultiAuthenticator returns a new multi Authenticator.

Stops on first matching SetAuth request.

func NewNetrcAuthenticator

func NewNetrcAuthenticator() Authenticator

NewNetrcAuthenticator returns a new netrc Authenticator.

func NewNopAuthenticator

func NewNopAuthenticator() Authenticator

NewNopAuthenticator returns a new nop Authenticator.

Always returns false and nil.

Jump to

Keyboard shortcuts

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