middleware

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GRPCAuthMetadataKey = "grpc-auth"

Variables

View Source
var RequestErrorText = "request error"
View Source
var RequestOkText = "request success"
View Source
var ServerErrorText = "server error"

Functions

func ContextWithGRPCAuth added in v0.4.1

func ContextWithGRPCAuth(ctx context.Context, token string) context.Context

func ExtractProviderToken added in v0.3.0

func ExtractProviderToken(ctx context.Context) (*oauth2.Token, error)

Get the token from request context.

func WithGrpcErrorLogging

func WithGrpcErrorLogging(log logr.Logger) runtime.ServeMuxOption

WithGrpcErrorLogging logs errors returned from server RPC handlers. Our errors happen in gRPC land, so we cannot introspect into the content of the error message in the WithLogging http.Handler. Normal gRPC middleware was not working for this: https://github.com/grpc-ecosystem/grpc-gateway/issues/1043

func WithLogging

func WithLogging(log logr.Logger, mux *runtime.ServeMux) http.Handler

WithLogging adds basic logging for HTTP requests. Note that this accepts a grpc-gateway ServeMux instead of an http.Handler.

func WithProviderToken added in v0.3.0

func WithProviderToken(jwtClient auth.JWTClient, h http.Handler, log logr.Logger) http.Handler

Injects the token into the request context to be retrieved later. Use the ExtractToken func inside the server handler where appropriate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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