middleware

package
v0.0.0-...-ceb5cd5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(enforcer enforcer.Enforcer) (*Authorizer, error)

NewAuthorizer initialises the Turing specific policies on the given auth enforcer and creates a new authorization middleware.

func (*Authorizer) Middleware

func (a *Authorizer) Middleware(next http.Handler) http.Handler

type OpenAPIValidation

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

OpenAPIValidation middleware validates HTTP requests against OpenAPI spec.

func NewOpenAPIV2Validation

func NewOpenAPIV2Validation(swaggerYamlFile string, options OpenAPIValidationOptions) (*OpenAPIValidation, error)

Create OpenAPIValidation object from swagger.yaml file with OpenAPI v2

func (*OpenAPIValidation) Middleware

func (openapi *OpenAPIValidation) Middleware(next http.Handler) http.Handler

Middleware returns a middleware function

func (*OpenAPIValidation) Validate

func (openapi *OpenAPIValidation) Validate(r *http.Request) error

Validate the request against the OpenAPI spec

type OpenAPIValidationOptions

type OpenAPIValidationOptions struct {
	// If true, ignore "securityDefinitions" in swagger.yaml.
	IgnoreAuthentication bool
	// If true, ignore "server" declarations in swagger.yaml when validating requests paths. Only consider the paths
	// relative to the server url versus checking the full paths (which include the server URL) in the requests.
	IgnoreServers bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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