Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 NewAuthInterceptor ¶
func NewAuthInterceptor(authenticator security.Authenticator) connect.Interceptor
NewAuthInterceptor creates a new authentication interceptor.
func NewContextSetupInterceptor ¶ added in v1.68.5
func NewContextSetupInterceptor( mainCtx context.Context, propagators ...func(ctx context.Context) context.Context, ) connect.Interceptor
NewContextSetupInterceptor creates a new context propagation 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.