connect

package
v1.71.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 12 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

func DefaultList added in v1.68.9

func DefaultList(
	_ context.Context,
	authI security.Authenticator,
	moreInterceptors ...connect.Interceptor,
) ([]connect.Interceptor, error)

func NewAuthInterceptor

func NewAuthInterceptor(authenticator security.Authenticator) connect.Interceptor

NewAuthInterceptor creates a new authentication interceptor.

func NewValidationInterceptor

func NewValidationInterceptor(opts ...Option) connect.Interceptor

NewValidationInterceptor builds an validationInterceptor. The default configuration is appropriate for most use cases.

Types

type Option added in v1.67.1

type Option interface {
	// contains filtered or unexported methods
}

An Option configures an [validationInterceptor].

func WithValidateResponses added in v1.67.1

func WithValidateResponses() Option

WithValidateResponses configures the [validationInterceptor] to also validate reponses in addition to validating requests.

By default:

- Unary: Response messages from the server are not validated. - Client streams: Received messages are not validated. - Server streams: Sent messages are not validated.

However, these messages are all validated if this option is set.

func WithValidator added in v1.67.1

func WithValidator(validator protovalidate.Validator) Option

WithValidator configures the [validationInterceptor] to use a customized protovalidate.Validator. By default, protovalidate.GlobalInterceptor is used See protovalidate.ValidatorOption for the range of available customizations.

func WithoutErrorDetails added in v1.67.1

func WithoutErrorDetails() Option

WithoutErrorDetails configures the [validationInterceptor] to elide error details from validation errors. By default, a protovalidate.ValidationError is added as a detail when validation errors are returned.

Jump to

Keyboard shortcuts

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