google

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultCachingKeySetProviderTimeToLive is a common default for the timeToLive parameter of CachingKeySetProvider.
	DefaultCachingKeySetProviderTimeToLive = time.Minute * 5
)
View Source
const JWTIssuer = "https://accounts.google.com"

JWTIssuer is a constant for Google's JWT issuer

View Source
const (
	// KeySetURL is URL of Google's Key Set.
	KeySetURL = "https://www.googleapis.com/oauth2/v1/certs"
)
View Source
const UserManagedServiceAccountEmailSuffix = ".iam.gserviceaccount.com"

UserManagedServiceAccountEmailSuffix asdf

Variables

This section is empty.

Functions

This section is empty.

Types

type KeySet

type KeySet = map[string]*x509.Certificate

KeySet contains entries where each entry represents a key identifier and certificate.

type KeySetProvider

type KeySetProvider interface {
	// The returned map should not be modified.
	Get(ctx context.Context) (KeySet, error)
}

KeySetProvider is an interface for getting a set of keys.

func CachingKeySetProvider

func CachingKeySetProvider(timeToLive time.Duration, base KeySetProvider) KeySetProvider

CachingKeySetProvider wrapss a KeySetProvider and adds caching.

func HTTPSKeySetProvider

func HTTPSKeySetProvider(httpClient *http.Client) KeySetProvider

HTTPSKeySetProvider gets keys from Google's Key Set endpoint (see KeySetURL).

func StaticKeySetProvider

func StaticKeySetProvider(keySet map[string]string) (KeySetProvider, error)

StaticKeySetProvider is an in-memory KeySetProvider. The values of the keySet parameter should be PEM encoded X509 certificates.

type ServiceAccountGetter

type ServiceAccountGetter = func(ctx context.Context, name string) (*iam.ServiceAccount, error)

ServiceAccountGetter is an abstraction for Google's Golang IAM service for the purpose of unit testing. name must be of the shape projects/x/serviceAccounts/y where x is * or the project ID and y is the email address or unique identifier of the service account. See https://cloud.google.com/iam/docs/reference/rest/v1/projects.serviceAccounts/get

type UserManagedServiceAccount

type UserManagedServiceAccount struct {
	Name    string
	Project string
}

UserManagedServiceAccount represents a user-managed service account. See https://cloud.google.com/iam/docs/service-accounts#user-managed

func ParseUserManagedServiceAccountFromEmail

func ParseUserManagedServiceAccountFromEmail(v string) (*UserManagedServiceAccount, error)

ParseUserManagedServiceAccountFromEmail parses v as a user-managed service account email. See https://cloud.google.com/iam/docs/service-accounts#user-managed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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