Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

oauth

v1.6.0
github.com/ppg/grpc-go/credentials/oauth

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

12 matches

Top ↑

Package oauth implements gRPC credentials using OAuth.

Functions

NewApplicationDefault

func NewApplicationDefault(ctx context.Context, scope ...string) (credentials.PerRPCCredentials, error)

NewApplicationDefault returns "Application Default Credentials". For more detail, see https://developers.google.com/accounts/docs/application-default-credentials.

NewComputeEngine

func NewComputeEngine() credentials.PerRPCCredentials

NewComputeEngine constructs the PerRPCCredentials that fetches access tokens from Google Compute Engine (GCE)'s metadata server. It is only valid to use this if your program is running on a GCE instance. TODO(dsymonds): Deprecate and remove this.

NewJWTAccessFromFile

func NewJWTAccessFromFile(keyFile string) (credentials.PerRPCCredentials, error)

NewJWTAccessFromFile creates PerRPCCredentials from the given keyFile.

NewJWTAccessFromKey

func NewJWTAccessFromKey(jsonKey []byte) (credentials.PerRPCCredentials, error)

NewJWTAccessFromKey creates PerRPCCredentials from the given jsonKey.

NewOauthAccess

func NewOauthAccess(token *oauth2.Token) credentials.PerRPCCredentials

NewOauthAccess constructs the PerRPCCredentials using a given token.

NewServiceAccountFromFile

func NewServiceAccountFromFile(keyFile string, scope ...string) (credentials.PerRPCCredentials, error)

NewServiceAccountFromFile constructs the PerRPCCredentials using the JSON key file of a Google Developers service account.

NewServiceAccountFromKey

func NewServiceAccountFromKey(jsonKey []byte, scope ...string) (credentials.PerRPCCredentials, error)

NewServiceAccountFromKey constructs the PerRPCCredentials using the JSON key slice from a Google Developers service account.

Types

TokenSource

type TokenSource struct {
	oauth2.TokenSource
}

TokenSource supplies PerRPCCredentials from an oauth2.TokenSource.

TokenSource.GetRequestMetadata

func (ts TokenSource) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

GetRequestMetadata gets the request metadata as a map from a TokenSource.

TokenSource.RequireTransportSecurity

func (ts TokenSource) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether the credentials requires transport security.

Dependency graph