auth

package
v0.0.0-...-ddbbf7b Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package auth authorizes programs to make HTTP requests to the discovery site.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Header(ctx context.Context, jsonCreds []byte, useExp bool) (_ string, err error)

Header returns a header value (typically a Bearer token) to be used in the HTTP 'Authorization' header.

func NewClient

func NewClient(ctx context.Context, jsonCreds []byte, useExp bool) (_ *http.Client, err error)

NewClient creates an http.Client for accessing go-discovery services. Its first argument is the JSON contents of a service account credentials file. If nil, default credentials are used. Its second argument determines which client ID to use.

func NewClientBearer

func NewClientBearer(token string) *http.Client

NewClientBearer creates an http.Client that adds an Authorization header containing its argument as a bearer token.

Types

type HeadersTransport

type HeadersTransport struct {
	Headers map[string]string
	Base    http.RoundTripper
}

HeadersTransport is an http.Transport that adds headers to the request.

func (*HeadersTransport) RoundTrip

func (t *HeadersTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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