package auth
import "golang.org/x/pkgsite/internal/auth"
Package auth authorizes programs to make HTTP requests to the discovery site.
Index ¶
- func Header(ctx context.Context, jsonCreds []byte, useExp bool) (_ string, err error)
- func NewClient(ctx context.Context, jsonCreds []byte, useExp bool) (_ *http.Client, err error)
- func NewClientBearer(token string) *http.Client
- type HeadersTransport
Functions ¶
func Header ¶
Header returns a header value (typically a Bearer token) to be used in the HTTP 'Authorization' header.
func NewClient ¶
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 ¶
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 ¶
Source Files ¶
auth.go
- Version
- v0.0.0-20250218150137-224a1368cf02 (latest)
- Published
- Feb 18, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 2 months ago –
Tools for package owners.