googleauth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package googleauth authenticates the REST catalog client with Google credentials, for catalogs such as BigLake. It is an optional backend: importing it (even as a blank import) registers the "google" auth type, so that rest.auth.type=google works, and it keeps the Google auth libraries out of the core catalog/rest package.

import (
	"github.com/apache/iceberg-go/catalog"
	_ "github.com/apache/iceberg-go/catalog/rest/googleauth"
)

cat, err := catalog.Load(ctx, "biglake", iceberg.Properties{
	"type":           "rest",
	"uri":            "https://biglake.googleapis.com/iceberg/v1/restcatalog",
	"warehouse":      "gs://my-bucket",
	"rest.auth.type": "google",
})

The properties match Iceberg Java's GoogleAuthManager:

  • gcp.auth.credentials-path: a credentials JSON file, such as a service account key.
  • gcp.auth.credentials-json: the same JSON, inline.
  • gcp.auth.scopes: comma-separated OAuth scopes, by default https://www.googleapis.com/auth/cloud-platform.

When neither credentials property is set, Application Default Credentials are used. Setting both is an error.

These properties, like rest.auth.type, are read only from the properties the client supplies, never from the server's /v1/config response. The credentials JSON may be of any type the Google auth library accepts, including external account configurations that fetch tokens from other hosts, so it must come from a source you control.

Token requests don't go through the catalog's HTTP client, so a transport, TLS config or proxy configured on the catalog doesn't apply to them, as in Java. They use a client with the default transport and a 60-second timeout. To use a specific client, put it in the context's oauth2.HTTPClient value when loading the catalog, or build the source with TokenSource and pass rest.NewOAuth2AuthManager(ts) to rest.WithAuthManager. One exception: on Google Cloud compute, Application Default Credentials come from the metadata server, which the Google library always reaches through its own client.

Index

Constants

View Source
const (
	CredentialsPathKey = "gcp.auth.credentials-path"
	CredentialsJSONKey = "gcp.auth.credentials-json"
	ScopesKey          = "gcp.auth.scopes"
)

Property names, as in Iceberg Java's GoogleAuthManager.

View Source
const DefaultScopes = "https://www.googleapis.com/auth/cloud-platform"

DefaultScopes is the scope requested when gcp.auth.scopes is unset.

Variables

This section is empty.

Functions

func TokenSource

func TokenSource(ctx context.Context, props iceberg.Properties) (oauth2.TokenSource, error)

TokenSource returns a token source for the Google credentials that props describe, using the gcp.auth.* properties. It is what rest.auth.type=google uses, exported for callers that build their own AuthManager.

Tokens are fetched after TokenSource returns, so the source keeps ctx's values but not its cancellation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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