oauth

package
Version: v0.0.0-...-926964d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2016 License: BSD-3-Clause, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package oauth implements gRPC credentials using OAuth.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApplicationDefault

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

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

func NewComputeEngine

func NewComputeEngine() credentials.Credentials

NewComputeEngine constructs the credentials 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.

func NewJWTAccessFromFile

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

func NewJWTAccessFromKey

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

func NewOauthAccess

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

NewOauthAccess constructs the credentials using a given token.

func NewServiceAccountFromFile

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

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

func NewServiceAccountFromKey

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

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

Types

type TokenSource

type TokenSource struct {
	oauth2.TokenSource
}

TokenSource supplies credentials from an oauth2.TokenSource.

func (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.

func (TokenSource) RequireTransportSecurity

func (ts TokenSource) RequireTransportSecurity() bool

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL