connect

package
v1.64.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingToken is returned when no authorization header is present.
	ErrMissingToken = errors.New("authorization header is required")
	// ErrMalformedToken is returned when the authorization header is malformed.
	ErrMalformedToken = errors.New("malformed authorization header")
	// ErrInvalidToken is returned when token authentication fails.
	ErrInvalidToken = errors.New("invalid authorization token")
)

Functions

This section is empty.

Types

type AuthInterceptor

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

AuthInterceptor implements connect.Interceptor for JWT authentication.

func NewAuthInterceptor

func NewAuthInterceptor(authenticator security.Authenticator) *AuthInterceptor

NewAuthInterceptor creates a new authentication interceptor.

func (*AuthInterceptor) WrapStreamingClient

WrapStreamingClient implements the streaming client interceptor (pass-through for server-side).

func (*AuthInterceptor) WrapStreamingHandler

WrapStreamingHandler implements the streaming handler interceptor for authentication.

func (*AuthInterceptor) WrapUnary

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

WrapUnary implements the unary interceptor for authentication.

type ValidationInterceptor

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

ValidationInterceptor implements connect.Interceptor for protovalidate validation.

func NewValidationInterceptor

func NewValidationInterceptor() (*ValidationInterceptor, error)

NewValidationInterceptor creates a new validation interceptor with default options.

func NewValidationInterceptorWithOptions

func NewValidationInterceptorWithOptions(opts ValidationOptions) (*ValidationInterceptor, error)

NewValidationInterceptorWithOptions creates a new validation interceptor with custom options.

func (*ValidationInterceptor) WrapStreamingClient

WrapStreamingClient validates streaming client messages (pass-through for server-side).

func (*ValidationInterceptor) WrapStreamingHandler

WrapStreamingHandler validates streaming messages.

func (*ValidationInterceptor) WrapUnary

WrapUnary validates unary requests and responses.

type ValidationLogger

type ValidationLogger interface {
	LogValidationError(ctx context.Context, direction string, err error)
}

ValidationLogger is an optional interface for logging validation errors.

type ValidationOptions

type ValidationOptions struct {
	// ValidateRequests enables request validation (default: true)
	ValidateRequests bool
	// ValidateResponses enables response validation (default: true)
	ValidateResponses bool
	// FailOnValidationError determines if validation errors should fail the request (default: true)
	FailOnValidationError bool
	// Logger for validation errors (optional)
	Logger ValidationLogger
}

ValidationOptions configures the validation interceptor.

func DefaultValidationOptions

func DefaultValidationOptions() ValidationOptions

DefaultValidationOptions returns the default validation options.

Jump to

Keyboard shortcuts

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