buf: github.com/bufbuild/buf/internal/pkg/httpauth Index | Files

package httpauth

import "github.com/bufbuild/buf/internal/pkg/httpauth"

Index

Package Files

env_authenticator.go httpauth.go multi_authenticator.go netrc_authenticator.go nop_authenticator.go util.go

type Authenticator Uses

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 Uses

func NewEnvAuthenticator(usernameKey string, passwordKey string) Authenticator

NewEnvAuthenticator returns a new env Authenticator for the environment.

func NewMultiAuthenticator Uses

func NewMultiAuthenticator(authenticators ...Authenticator) Authenticator

NewMultiAuthenticator returns a new multi Authenticator.

Stops on first matching SetAuth request.

func NewNetrcAuthenticator Uses

func NewNetrcAuthenticator() Authenticator

NewNetrcAuthenticator returns a new netrc Authenticator.

func NewNopAuthenticator Uses

func NewNopAuthenticator() Authenticator

NewNopAuthenticator returns a new nop Authenticator.

Always returns false and nil.

Package httpauth imports 5 packages (graph) and is imported by 3 packages. Updated 2020-07-17. Refresh now. Tools for package owners.