connectinterceptors

package
v0.84.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAvailable      = connect.NewError(connect.CodeUnavailable, fmt.Errorf("function not available at the moment"))
	ErrDeniedInvalidArgs = connect.NewError(connect.CodePermissionDenied, errors.New("invalid arguments"))
)

Functions

func CookieSameSite

func CookieSameSite(name string) http.SameSite

func UnaryConnectErrorResponseInterceptor added in v0.79.0

func UnaryConnectErrorResponseInterceptor() connect.UnaryInterceptorFunc

UnaryConnectErrorResponseInterceptor handles error processing after the handler executes but before the logger interceptor logs the response. This interceptor normalizes context-related errors and wraps them in proper Connect error types.

func UnaryConnectLoggerInterceptor

func UnaryConnectLoggerInterceptor(logger *zap.Logger, opts *LoggerOptions) connect.UnaryInterceptorFunc

func WithConnectCORS added in v0.82.0

func WithConnectCORS(connectHandler http.Handler, conf CorsConfig) http.Handler

WithConnectCORS adds CORS support to a Connect HTTP handler. It uses Connect-specific methods, headers, and exposed headers from the connectcors package.

Types

type AuditInterceptor added in v0.84.1

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

func NewAuditInterceptor added in v0.84.1

func NewAuditInterceptor(service *audit.Service) *AuditInterceptor

func (*AuditInterceptor) WrapStreamingClient added in v0.84.1

func (*AuditInterceptor) WrapStreamingHandler added in v0.84.1

func (*AuditInterceptor) WrapUnary added in v0.84.1

func (a *AuditInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc

type AuthenticationInterceptor added in v0.71.0

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

func NewAuthenticationInterceptor added in v0.71.0

func NewAuthenticationInterceptor(h *v1beta1connect.ConnectHandler, sessionHeaderConfig authenticate.SessionMetadataHeaders) *AuthenticationInterceptor

func (*AuthenticationInterceptor) WrapStreamingClient added in v0.71.0

func (*AuthenticationInterceptor) WrapStreamingHandler added in v0.71.0

func (*AuthenticationInterceptor) WrapUnary added in v0.71.0

type AuthorizationInterceptor added in v0.71.0

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

func NewAuthorizationInterceptor added in v0.71.0

func NewAuthorizationInterceptor(h *v1beta1connect.ConnectHandler) *AuthorizationInterceptor

func (*AuthorizationInterceptor) WrapStreamingClient added in v0.71.0

func (*AuthorizationInterceptor) WrapStreamingHandler added in v0.71.0

func (*AuthorizationInterceptor) WrapUnary added in v0.71.0

type CorsConfig added in v0.82.0

type CorsConfig struct {
	AllowedOrigins []string `yaml:"allowed_origins" mapstructure:"allowed_origins" default:""`
	MaxAge         int      `yaml:"max_age" mapstructure:"max_age" default:"7200"`
}

type LoggerOption

type LoggerOption struct {
	// Decider returns true if method should be logged
	Decider func(procedure string) bool
}

type LoggerOptions

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

func NewLoggerOptions

func NewLoggerOptions(opts ...LoggerOption) *LoggerOptions

type SessionInterceptor added in v0.71.0

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

func NewSessionInterceptor added in v0.71.0

func NewSessionInterceptor(cookieCutter securecookie.Codec, conf authenticate.SessionConfig, h *v1beta1connect.ConnectHandler) *SessionInterceptor

func (*SessionInterceptor) UnaryConnectRequestHeadersAnnotator added in v0.71.0

func (s *SessionInterceptor) UnaryConnectRequestHeadersAnnotator() connect.UnaryInterceptorFunc

UnaryConnectRequestHeadersAnnotator converts session cookies set in grpc metadata to context this requires decrypting the cookie and setting it as context

func (*SessionInterceptor) UnaryConnectResponseInterceptor added in v0.71.0

func (s *SessionInterceptor) UnaryConnectResponseInterceptor() connect.UnaryInterceptorFunc

UnaryConnectResponseInterceptor adds session cookie to response if session id is present in header

func (*SessionInterceptor) WrapStreamingClient added in v0.71.0

func (*SessionInterceptor) WrapStreamingHandler added in v0.71.0

func (*SessionInterceptor) WrapUnary added in v0.71.0

Jump to

Keyboard shortcuts

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