Back to

Package httpauth

Latest Go to latest

The latest major version is .

Published: Jul 24, 2020 | License: Apache-2.0 | Module:


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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier