buildgolang.org/x/build/internal/iapclient Index | Files

package iapclient

import "golang.org/x/build/internal/iapclient"

Package iapclient enables programmatic access to IAP-secured services. See https://cloud.google.com/iap/docs/authentication-howto.

Login will be done as necessary using offline browser-based authentication, similarly to gcloud auth login. Credentials will be stored in the user's config directory.

Index

Functions

func GRPCClient

func GRPCClient(ctx context.Context, addr string) (*grpc.ClientConn, error)

GRPCClient returns a *gprc.ClientConn that can access Go's IAP-protected servers. It will prompt for login if necessary.

func HTTPClient

func HTTPClient(ctx context.Context) (*http.Client, error)

HTTPClient returns an http.Client that can be used to access Go's IAP-protected sites. It will prompt for login if necessary.

func TokenSource

func TokenSource(ctx context.Context) (oauth2.TokenSource, error)

TokenSource returns a TokenSource that can be used to access Go's IAP-protected sites. It will prompt for login if necessary.

func TokenSourceForceLogin

func TokenSourceForceLogin(ctx context.Context) (oauth2.TokenSource, error)

TokenSourceForceLogin returns a TokenSource that can be used to access Go's IAP-protected sites. It will delete any existing authentication token credentials and prompt for login.

Types

type AuthenticationError

type AuthenticationError struct {
	Description string
	Err         error
}

AuthenticationError records an authentication error.

func (AuthenticationError) Error

func (ar AuthenticationError) Error() string

func (AuthenticationError) Unwrap

func (ar AuthenticationError) Unwrap() error

Source Files

iapclient.go

Version
v0.0.0-20250421191922-3619c213cff3 (latest)
Published
Apr 21, 2025
Platform
linux/amd64
Imports
18 packages
Last checked
3 months ago

Tools for package owners.