Documentation ¶
Index ¶
- func Logger() func(next http.Handler) http.Handler
- func OpenAPIValidatorMiddlewareFactory(authorizer *Authorizer, openapi *OpenAPI) func(http.Handler) http.Handler
- func Timeout(timeout time.Duration) func(http.Handler) http.Handler
- type Authorizer
- type LoggingSpanProcessor
- type OpenAPI
- type OpenAPIValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenAPIValidatorMiddlewareFactory ¶
func OpenAPIValidatorMiddlewareFactory(authorizer *Authorizer, openapi *OpenAPI) func(http.Handler) http.Handler
OpenAPIValidatorMiddlewareFactory returns a function that generates per-request middleware functions.
Types ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
Authorizer provides OpenAPI based authorization middleware.
func NewAuthorizer ¶
func NewAuthorizer(issuer *jose.JWTIssuer) *Authorizer
NewAuthorizer returns a new authorizer with required parameters.
type LoggingSpanProcessor ¶
type LoggingSpanProcessor struct{}
LoggingSpanProcessor is a OpenTelemetry span processor that logs to standard out in whatever format is defined by the logger.
func (*LoggingSpanProcessor) ForceFlush ¶
func (*LoggingSpanProcessor) ForceFlush(ctx context.Context) error
func (*LoggingSpanProcessor) OnEnd ¶
func (*LoggingSpanProcessor) OnEnd(s sdktrace.ReadOnlySpan)
func (*LoggingSpanProcessor) OnStart ¶
func (*LoggingSpanProcessor) OnStart(ctx context.Context, s sdktrace.ReadWriteSpan)
type OpenAPI ¶
type OpenAPI struct {
// contains filtered or unexported fields
}
OpenAPI abstracts schema access and validation.
func NewOpenAPI ¶
NewOpenRpi extracts the swagger document. NOTE: this is surprisingly slow, make sure you cache it and reuse it.
type OpenAPIValidator ¶
type OpenAPIValidator struct {
// contains filtered or unexported fields
}
OpenAPIValidator provides OpenAPI validation of request and response codes, media, and schema validation of payloads to ensure we are meeting the specification.
func NewOpenAPIValidator ¶
func NewOpenAPIValidator(authorizer *Authorizer, next http.Handler, openapi *OpenAPI) *OpenAPIValidator
NewOpenAPIValidator returns an initialized validator middleware.
func (*OpenAPIValidator) ServeHTTP ¶
func (v *OpenAPIValidator) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface.