server2serverauth

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package server2serverauth is used for sending gRPC requests between Google Cloud hosted services (like Cloud Run instances).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IncomingTokenPayload

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

IncomingTokenPayload is data embedded in the token that has been validated by a trusted authority (typically Google).

func (*IncomingTokenPayload) Email

func (p *IncomingTokenPayload) Email() string

type Sender

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

func NewSender

func NewSender(ctx context.Context, audience string) (*Sender, error)

NewSender returns a new object used for sending authenticating information to another server.

func (*Sender) AddTokenToOutgoingContext

func (p *Sender) AddTokenToOutgoingContext(ctx context.Context) (context.Context, error)

AddTokenToOutgoingContext returns a new context.Context with an ("Authorozation", "Bearer xxxx") header in the gRPC metadata.

func (*Sender) PerRPCCredentials

func (p *Sender) PerRPCCredentials() credentials.PerRPCCredentials

PerRPCCredentials returns a new context.Context with an ("Authorozation", "Bearer xxxx") header in the gRPC metadata.

type Validator

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

Validator is used for validating requests coming from other servers.

func NewValidator

func NewValidator(ctx context.Context, audience string) (*Validator, error)

NewValidator constructs a Validator for use by a server that needs to validate other servers.

func (*Validator) ValidateFromIncomingContext

func (v *Validator) ValidateFromIncomingContext(ctx context.Context) (*IncomingTokenPayload, error)

ValidateFromIncomingContext extracts a validated payload from the gRPC metadata of an incoming request.

Jump to

Keyboard shortcuts

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