jwtclient

package
v0.0.0-...-ca82998 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package jwtclient facilitates creation of HTTP clients that use JSON web tokens for two-legged OAuth2 authentication with Google's service APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, keydata []byte, scope ...string) (*http.Client, error)

New returns an OAuth2 authenticating HTTP client for the given key data and scope(s).

The key data must be in JSON format.

The client will only be valid as long as the given context is valid.

func NewFromKeyfile

func NewFromKeyfile(ctx context.Context, keyfile string, scope ...string) (*http.Client, error)

NewFromKeyfile returns an OAuth2 authenticating HTTP client for the given key file and scope(s).

The key data contained within the key file must be in JSON format.

The client will only be valid as long as the given context is valid.

func NewFromKeyfileWithSubject

func NewFromKeyfileWithSubject(ctx context.Context, keyfile, subject string, scope ...string) (*http.Client, error)

NewFromKeyfileWithSubject returns an OAuth2 authenticating HTTP client for the given key file, subject and scope(s).

The key data contained within the key file must be in JSON format.

The client will only be valid as long as the given context is valid.

func NewWithSubject

func NewWithSubject(ctx context.Context, keydata []byte, subject string, scope ...string) (*http.Client, error)

NewWithSubject returns an OAuth2 authenticating HTTP client for the given key data, subject and scope(s).

The key data must be in JSON format.

The client will only be valid as long as the given context is valid.

Types

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source is a source of JWT HTTP clients that share a common configuration but can differ in impersonation subjects.

func NewSource

func NewSource(keydata []byte, scope ...string) (*Source, error)

NewSource returns a new source of OAuth2 authenticating HTTP clients. The clients returned by the source will use the given key data and scope(s).

The key data must be in JSON format.

func NewSourceFromKeyfile

func NewSourceFromKeyfile(keyfile string, scope ...string) (*Source, error)

NewSourceFromKeyfile returns a source of OAuth2 authenticating HTTP clients. The clients returned by the source will use the key data contained in the given key file and will use given scope(s).

The key data contained within the key file must be in JSON format.

func (*Source) Client

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

Client returns a new HTTP client with the key data and scope(s) defined by the source.

The client will only be valid as long as the given context is valid.

func (*Source) ClientWithSubject

func (s *Source) ClientWithSubject(ctx context.Context, subject string) (*http.Client, error)

ClientWithSubject returns a new HTTP client for the given subject with the key data and scope(s) defined by the source.

The client will only be valid as long as the given context is valid.

Jump to

Keyboard shortcuts

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