interceptor

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MPL-2.0 Imports: 8 Imported by: 6

Documentation

Overview

Package interceptor contains gRPC client interceptors related to authentication and authorization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthEnabledFunc

type AuthEnabledFunc func(ctx context.Context, cc *grpc.ClientConn) (bool, error)

AuthEnabledFunc is called once to determine if auth is enabled.

type Signature

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

Signature is a gRPC client interceptor which signs requests.

func NewSignature

func NewSignature(identity string, signerFunc SignerFunc, renewSignerFunc SignerFunc, authEnabledFunc AuthEnabledFunc) *Signature

NewSignature returns a new Signature interceptor.

renewSignerFunc is a function which is called when the initial Signer is invalid (e.g. got a response with codes.Unauthenticated).

authEnabledFunc is called only once, on the first request to determine if auth is enabled. If the result is false, the interceptor will simply pass the following requests through.

func (*Signature) Stream

Stream returns a new streaming client interceptor which signs requests.

func (*Signature) Unary

Unary returns a new unary client interceptor which signs requests.

type SignerFunc

type SignerFunc func(ctx context.Context, cc *grpc.ClientConn) (message.Signer, error)

SignerFunc is a function which is called to get a signer.

type SkipInterceptorContextKey

type SkipInterceptorContextKey struct{}

SkipInterceptorContextKey is a context key used to skip interceptor to avoid infinite recursion.

Jump to

Keyboard shortcuts

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