dpop_grpc

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dpop_grpc provides gRPC client interceptors with DPoP support

Package dpop_grpc provides gRPC server interceptors with DPoP support

Index

Constants

View Source
const (
	// AuthorizationHeaderName is the name of the Authorization header
	AuthorizationHeaderName = "authorization"
)

Variables

View Source
var (
	// ErrMissingDPoPHeader is returned when the DPoP header is missing
	ErrMissingDPoPHeader = errors.New("missing DPoP header")

	// ErrInvalidDPoPHeader is returned when the DPoP header is invalid
	ErrInvalidDPoPHeader = errors.New("invalid DPoP header")
)

Functions

func ClientStreamInterceptor

func ClientStreamInterceptor(key *jose.JSONWebKey, tokenSource oauth2.TokenSource, proofOpts []dpop.ProofOption) (grpc.StreamClientInterceptor, error)

ClientStreamInterceptor creates a new stream client interceptor with DPoP and OAuth2 support

func ClientUnaryInterceptor

func ClientUnaryInterceptor(key *jose.JSONWebKey, tokenSource oauth2.TokenSource, proofOpts []dpop.ProofOption) (grpc.UnaryClientInterceptor, error)

ClientUnaryInterceptor creates a new unary client interceptor with DPoP and OAuth2 support

func ServerStreamInterceptor

func ServerStreamInterceptor(opts ...ServerOption) grpc.StreamServerInterceptor

ServerStreamInterceptor creates a new stream server interceptor with DPoP support

func ServerUnaryInterceptor

func ServerUnaryInterceptor(opts ...ServerOption) grpc.UnaryServerInterceptor

ServerUnaryInterceptor creates a new unary server interceptor with DPoP support

Types

type DPoPCredentials

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

DPoPCredentials implements the credentials.PerRPCCredentials interface to provide DPoP proof generation and OAuth2 token injection for gRPC calls

func NewDPoPCredentials

func NewDPoPCredentials(
	proofer *dpop.Proofer,
	tokenSource oauth2.TokenSource,
	authority string,
	proofOpts []dpop.ProofOption,
) (*DPoPCredentials, error)

NewDPoPCredentials creates a new DPoPCredentials instance

func (*DPoPCredentials) GetRequestMetadata

func (d *DPoPCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

GetRequestMetadata implements credentials.PerRPCCredentials.GetRequestMetadata

func (*DPoPCredentials) RequireTransportSecurity

func (d *DPoPCredentials) RequireTransportSecurity() bool

RequireTransportSecurity implements credentials.PerRPCCredentials.RequireTransportSecurity

type ServerOption

type ServerOption func(*serverOptions)

ServerOption configures how we set up the DPoP interceptor

func WithAuthority

func WithAuthority(authority string) ServerOption

func WithNonceGenerator

func WithNonceGenerator(ng dpop.NonceGenerator) ServerOption

WithNonceGenerator sets the nonce generator for DPoP proofs

func WithValidationOptions

func WithValidationOptions(opts ...dpop.Option) ServerOption

WithValidationOptions sets the validation options for DPoP proof validation

Jump to

Keyboard shortcuts

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