auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(ctx context.Context, method, endpoint string, c Credentials) (*http.Request, error)

NewRequest wraps the standard http.NewRequestWithContext but also applies credentials when applicable.

Types

type Credentials

type Credentials interface {
	// contains filtered or unexported methods
}

func BasicAuth

func BasicAuth(username, password string) Credentials

BasicAuth generates a Credentials set which sets the supplied username and password via basic authentication.

func BearerToken

func BearerToken(token string) Credentials

BearerToken sets the supplied token as a Authorization Bearer token on each request.

func FromHeader

func FromHeader(key, value string) Credentials

FromHeader generates credentials which allow us to set the header key and value on the request.

func FromQueryString

func FromQueryString(key, value string) Credentials

FromQueryString generates credentials where the key is assigned to the query string.

Jump to

Keyboard shortcuts

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